[PATCH 3/3] 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.
---
 client/gvfsfusedaemon.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 5763c1c..3f92a1d 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() */
-- 
1.8.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]