summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2014-07-29 17:41:45 +0100
committerRoss Lagerwall <rosslagerwall@gmail.com>2014-10-26 15:58:56 +0000
commit58db1bd073a8f5f0eaadd9cc56f57c952e43f49e (patch)
tree7c8aafd0e15c4ac77a9eeebf0b1545697194c899 /client
parent1ff4d6c13358ca3efbece1cf81298b44fdc8e855 (diff)
downloadgvfs-58db1bd073a8f5f0eaadd9cc56f57c952e43f49e.tar.gz
fuse: Pass the correct flags when reopening output stream
If a file is open for reading and writing, ensure to pass the O_APPEND flag if necessary when reopening the output stream. This allows a write-read-write sequence to work properly if the file is opened for O_APPEND. The O_TRUNC flag is not passed since this would cause a write-read-write sequence to truncate the file on the second write. As it is, the second write fails with ENOTSUP since this kind of operation is not supported by GVFS. https://bugzilla.gnome.org/show_bug.cgi?id=632296
Diffstat (limited to 'client')
-rw-r--r--client/gvfsfusedaemon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index de37c3b2..54593db6 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -1503,7 +1503,7 @@ vfs_write (const gchar *path, const gchar *buf, size_t len, off_t offset,
{
g_mutex_lock (&fh->mutex);
- result = setup_output_stream (file, fh, 0);
+ result = setup_output_stream (file, fh, fi->flags & O_APPEND);
if (result == 0)
{
result = write_stream (fh, fi->flags & O_APPEND,
@@ -1989,7 +1989,7 @@ vfs_ftruncate (const gchar *path, off_t size, struct fuse_file_info *fi)
{
g_mutex_lock (&fh->mutex);
- result = setup_output_stream (file, fh, 0);
+ result = setup_output_stream (file, fh, fi->flags & O_APPEND);
if (result == 0)
result = truncate_stream (file, fh, size);