[gvfs/wip/oholy/fuse-seek-fallback] fuse: Reopen file and skip to desired offset if seek is not supported
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/fuse-seek-fallback] fuse: Reopen file and skip to desired offset if seek is not supported
- Date: Tue, 14 Jan 2020 12:50:24 +0000 (UTC)
commit e2e92fe2dd36fb2f48e0dc8267907bf76a73c77e
Author: Ondrej Holy <oholy redhat com>
Date: Tue Jan 14 13:34:40 2020 +0100
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
client/gvfsfusedaemon.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]