summaryrefslogtreecommitdiff
path: root/client/gvfsfusedaemon.c
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2012-12-07 17:53:30 +0100
committerTomas Bzatek <tbzatek@redhat.com>2012-12-07 17:53:30 +0100
commit9088dbe0ed3a52f85ce4a87baa6ac4bfa8248c8f (patch)
treeddb88e319a006a979006f9dc2bc2ea2bc42a20a8 /client/gvfsfusedaemon.c
parentbf5493fc31ca6555390a076d7ce18872b7c0c0ec (diff)
downloadgvfs-9088dbe0ed3a52f85ce4a87baa6ac4bfa8248c8f.tar.gz
fuse: Make truncating more robust
Don't try to seek if there was an error during padding. Also report seek errors.
Diffstat (limited to 'client/gvfsfusedaemon.c')
-rw-r--r--client/gvfsfusedaemon.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 503ec0b4..6bb21e7e 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