[gvfs] fuse: Make file nonseekable if it actually is



commit 50e927218909b87bce5bc792621b7db8c47538fc
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Wed Sep 25 20:42:35 2013 +0200

    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 files changed, 3 insertions(+), 0 deletions(-)
---
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() */


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