[gvfs] fuse: Make truncating more robust



commit 9088dbe0ed3a52f85ce4a87baa6ac4bfa8248c8f
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Fri Dec 7 17:53:30 2012 +0100

    fuse: Make truncating more robust
    
    Don't try to seek if there was an error during padding. Also report
    seek errors.

 client/gvfsfusedaemon.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 503ec0b..6bb21e7 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -1915,9 +1915,10 @@ vfs_ftruncate (const gchar *path, off_t size, struct fuse_file_info *fi)
                     {
                       /* If the truncated size is larger than the current size
                        * then we need to pad out the difference with 0's */
-                     goffset orig_pos = g_seekable_tell (G_SEEKABLE (fh->stream));
-                     result = pad_file (fh, size - current_size, current_size);
-                     g_seekable_seek (G_SEEKABLE (fh->stream), orig_pos, G_SEEK_SET, NULL, NULL);
+                      goffset orig_pos = g_seekable_tell (G_SEEKABLE (fh->stream));
+                      result = pad_file (fh, size - current_size, current_size);
+                      if (result == 0)
+                        g_seekable_seek (G_SEEKABLE (fh->stream), orig_pos, G_SEEK_SET, NULL, &error);
                     }
 		}
 	      else



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