aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/file_input_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/file_input_plugin.c')
-rw-r--r--src/input/file_input_plugin.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/input/file_input_plugin.c b/src/input/file_input_plugin.c
index 3646c656e..5ee3f200b 100644
--- a/src/input/file_input_plugin.c
+++ b/src/input/file_input_plugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2010 The Music Player Daemon Project
+ * Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -19,6 +19,7 @@
#include "config.h" /* must be first for large file support */
#include "input/file_input_plugin.h"
+#include "input_internal.h"
#include "input_plugin.h"
#include "fd_util.h"
#include "open.h"
@@ -45,14 +46,16 @@ file_quark(void)
}
static struct input_stream *
-input_file_open(const char *filename, GError **error_r)
+input_file_open(const char *filename,
+ GMutex *mutex, GCond *cond,
+ GError **error_r)
{
int fd, ret;
struct stat st;
struct file_input_stream *fis;
if (!g_path_is_absolute(filename))
- return false;
+ return NULL;
fd = open_cloexec(filename, O_RDONLY|O_BINARY, 0);
if (fd < 0) {
@@ -60,7 +63,7 @@ input_file_open(const char *filename, GError **error_r)
g_set_error(error_r, file_quark(), errno,
"Failed to open \"%s\": %s",
filename, g_strerror(errno));
- return false;
+ return NULL;
}
ret = fstat(fd, &st);
@@ -69,14 +72,14 @@ input_file_open(const char *filename, GError **error_r)
"Failed to stat \"%s\": %s",
filename, g_strerror(errno));
close(fd);
- return false;
+ return NULL;
}
if (!S_ISREG(st.st_mode)) {
g_set_error(error_r, file_quark(), 0,
"Not a regular file: %s", filename);
close(fd);
- return false;
+ return NULL;
}
#ifdef POSIX_FADV_SEQUENTIAL
@@ -84,7 +87,8 @@ input_file_open(const char *filename, GError **error_r)
#endif
fis = g_new(struct file_input_stream, 1);
- input_stream_init(&fis->base, &input_plugin_file, filename);
+ input_stream_init(&fis->base, &input_plugin_file, filename,
+ mutex, cond);
fis->base.size = st.st_size;
fis->base.seekable = true;