Commit e2e92fe2 authored by Ondrej Holy's avatar Ondrej Holy

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: #441
parent 70948301
Pipeline #143547 passed with stage
in 1 minute and 15 seconds
......@@ -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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment