From ef0392e854aa5b0388d6245e7d506b1caffb970d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Oct 2012 09:45:13 +0200 Subject: input/file: use errno_quark() --- src/input/file_input_plugin.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/input/file_input_plugin.c b/src/input/file_input_plugin.c index 5ee3f200b..e130230a7 100644 --- a/src/input/file_input_plugin.c +++ b/src/input/file_input_plugin.c @@ -23,6 +23,7 @@ #include "input_plugin.h" #include "fd_util.h" #include "open.h" +#include "io_error.h" #include #include @@ -39,12 +40,6 @@ struct file_input_stream { int fd; }; -static inline GQuark -file_quark(void) -{ - return g_quark_from_static_string("file"); -} - static struct input_stream * input_file_open(const char *filename, GMutex *mutex, GCond *cond, @@ -60,7 +55,7 @@ input_file_open(const char *filename, fd = open_cloexec(filename, O_RDONLY|O_BINARY, 0); if (fd < 0) { if (errno != ENOENT && errno != ENOTDIR) - g_set_error(error_r, file_quark(), errno, + g_set_error(error_r, errno_quark(), errno, "Failed to open \"%s\": %s", filename, g_strerror(errno)); return NULL; @@ -68,7 +63,7 @@ input_file_open(const char *filename, ret = fstat(fd, &st); if (ret < 0) { - g_set_error(error_r, file_quark(), errno, + g_set_error(error_r, errno_quark(), errno, "Failed to stat \"%s\": %s", filename, g_strerror(errno)); close(fd); @@ -76,7 +71,7 @@ input_file_open(const char *filename, } if (!S_ISREG(st.st_mode)) { - g_set_error(error_r, file_quark(), 0, + g_set_error(error_r, errno_quark(), 0, "Not a regular file: %s", filename); close(fd); return NULL; @@ -107,7 +102,7 @@ input_file_seek(struct input_stream *is, goffset offset, int whence, offset = (goffset)lseek(fis->fd, (off_t)offset, whence); if (offset < 0) { - g_set_error(error_r, file_quark(), errno, + g_set_error(error_r, errno_quark(), errno, "Failed to seek: %s", g_strerror(errno)); return false; } @@ -125,7 +120,7 @@ input_file_read(struct input_stream *is, void *ptr, size_t size, nbytes = read(fis->fd, ptr, size); if (nbytes < 0) { - g_set_error(error_r, file_quark(), errno, + g_set_error(error_r, errno_quark(), errno, "Failed to read: %s", g_strerror(errno)); return 0; } -- cgit v1.2.3