summaryrefslogtreecommitdiff
path: root/client/gvfsfusedaemon.c
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2020-01-14 13:34:40 +0100
committerOndrej Holy <oholy@redhat.com>2020-01-29 08:57:55 +0000
commit108979c2802ec07ab6eaee2a76d3762525c69b68 (patch)
tree72e916f7cf4208db072ef3af1995899d26fed089 /client/gvfsfusedaemon.c
parentbbc95d6716ac491489f059c68a6dd258e38aee79 (diff)
downloadgvfs-108979c2802ec07ab6eaee2a76d3762525c69b68.tar.gz
fuse: Reopen file and skip to desired offset if seek is not supported
The fuse daemon can fail when client attempts to seek backwards and seek is not supported by the concrete backend. There is fallback for forward seeks using `g_input_stream_skip`. Let's reopen the file and use the same approach also for backwards seeks. This is pretty ugly to reopen the file but similar approach is used already to emulate read/write mode. Fixes: https://gitlab.gnome.org/GNOME/gvfs/issues/441
Diffstat (limited to 'client/gvfsfusedaemon.c')
-rw-r--r--client/gvfsfusedaemon.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 47f4e4c6..e2038504 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -1363,6 +1363,14 @@ vfs_read (const gchar *path, gchar *buf, size_t size,
if (result == 0)
{
result = read_stream (fh, buf, size, offset);
+
+ if (result == -ENOTSUP && offset < fh->pos)
+ {
+ file_handle_close_stream (fh);
+ result = setup_input_stream (file, fh);
+ if (result == 0)
+ result = read_stream (fh, buf, size, offset);
+ }
}
else
{