diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2012-12-07 17:53:30 +0100 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2012-12-07 17:53:30 +0100 |
commit | 9088dbe0ed3a52f85ce4a87baa6ac4bfa8248c8f (patch) | |
tree | ddb88e319a006a979006f9dc2bc2ea2bc42a20a8 /client | |
parent | bf5493fc31ca6555390a076d7ce18872b7c0c0ec (diff) | |
download | gvfs-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')
-rw-r--r-- | client/gvfsfusedaemon.c | 7 |
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 |