diff options
Diffstat (limited to '')
-rw-r--r-- | lib/file.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -1,6 +1,4 @@ -#include "file.h" -#include "error.h" -#include "convert.h" +#include "lslib.h" #include <paths.h> #include <errno.h> @@ -21,7 +19,7 @@ FILE* get_file_s(const char* path, const char* type) { if (lstat(path, &s) < 0) { if (type[0] != 'r') goto read; - error_s("failed to read %s: %s", path, strerror(errno)); + error_s("failed to read %s", path); return NULL; } @@ -35,7 +33,7 @@ read: file = fopen(path, type); if (file == NULL) { - error_s("failed to %s file %s: %s", type[0] == 'r' ? "read" : "write", path, strerror(errno)); + error_s("failed to %s file %s", type[0] == 'r' ? "read" : "write", path); } return file; @@ -48,8 +46,8 @@ FILE* get_file(const char* path, const char* type) { } int get_tty (void) { - int fd = open(_PATH_TTY, O_RDONLY); - if (fd < 0) error("failed to get tty: %s", strerror(errno)); + int fd = open(_PATH_TTY, O_RDONLY | O_NOCTTY | O_SYNC); + if (fd < 0) error("failed to get tty"); return fd; } @@ -57,7 +55,7 @@ FILE* get_tty_stream(char* type) { int fd = get_tty(); FILE* file = fdopen(fd, type); if (file == NULL) { - error("failed to open tty stream: %s", strerror(errno)); + error("failed to open tty stream"); } return file; } |