aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-10-04 09:45:13 +0200
committerMax Kellermann <max@duempel.org>2012-10-04 10:32:04 +0200
commitef0392e854aa5b0388d6245e7d506b1caffb970d (patch)
tree6304e2496f6ee3dafbd8ab7241a2a69eb02e0ca7
parentefbf184fe80c61f7666ded3342fcb97c1b770758 (diff)
downloadmpd-ef0392e854aa5b0388d6245e7d506b1caffb970d.tar.gz
mpd-ef0392e854aa5b0388d6245e7d506b1caffb970d.tar.xz
mpd-ef0392e854aa5b0388d6245e7d506b1caffb970d.zip
input/file: use errno_quark()
Diffstat (limited to '')
-rw-r--r--src/input/file_input_plugin.c17
1 files changed, 6 insertions, 11 deletions
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 <sys/stat.h>
#include <unistd.h>
@@ -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;
}