summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2013-09-25 20:42:35 +0200
committerAlexander Larsson <alexl@redhat.com>2013-10-02 10:20:01 +0200
commit50e927218909b87bce5bc792621b7db8c47538fc (patch)
treeae25860bbe53e0fa1b1c6caf4d0cfc59c0fa59f8
parent3e8cc556fe13a32518ebdd4c11a11f0006083844 (diff)
downloadgvfs-50e927218909b87bce5bc792621b7db8c47538fc.tar.gz
fuse: Make file nonseekable if it actually is
Instead of failing in read() with ENOTSUPP after the lseek on a nonseekable stream succeeds, make the lseek fail with ESPIPE, as it should. This is important for applications which test the return value of lseek to determine if the file descriptor is seekable.
-rw-r--r--client/gvfsfusedaemon.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 5763c1ca..3f92a1d6 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -998,6 +998,9 @@ open_common (const gchar *path, struct fuse_file_info *fi, GFile *file, int outp
else
result = setup_input_stream (file, fh);
+ if (fh->stream)
+ fi->nonseekable = !g_seekable_can_seek (G_SEEKABLE (fh->stream));
+
g_mutex_unlock (&fh->mutex);
/* The added reference to the file handle is released in vfs_release() */