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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/input/file_input_plugin.c b/src/input/file_input_plugin.c
index bda1777ac..73dcf4c0f 100644
--- a/src/input/file_input_plugin.c
+++ b/src/input/file_input_plugin.c
@@ -17,8 +17,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "config.h" /* must be first for large file support */
#include "input/file_input_plugin.h"
#include "input_plugin.h"
+#include "fd_util.h"
#include <sys/stat.h>
#include <fcntl.h>
@@ -36,10 +38,10 @@ input_file_open(struct input_stream *is, const char *filename)
int fd, ret;
struct stat st;
- if (filename[0] != '/')
+ if (!g_path_is_absolute(filename))
return false;
- fd = open(filename, O_RDONLY);
+ fd = open_cloexec(filename, O_RDONLY, 0);
if (fd < 0) {
is->error = errno;
g_debug("Failed to open \"%s\": %s",
@@ -77,11 +79,11 @@ input_file_open(struct input_stream *is, const char *filename)
}
static bool
-input_file_seek(struct input_stream *is, off_t offset, int whence)
+input_file_seek(struct input_stream *is, goffset offset, int whence)
{
int fd = GPOINTER_TO_INT(is->data);
- offset = lseek(fd, offset, whence);
+ offset = (goffset)lseek(fd, (off_t)offset, whence);
if (offset < 0) {
is->error = errno;
return false;