[gvfs] fuse: Pass the correct flags when reopening output stream
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] fuse: Pass the correct flags when reopening output stream
- Date: Sun, 26 Oct 2014 15:59:54 +0000 (UTC)
commit 58db1bd073a8f5f0eaadd9cc56f57c952e43f49e
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Tue Jul 29 17:41:45 2014 +0100
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
client/gvfsfusedaemon.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index de37c3b..54593db 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]