# HG changeset patch # User Paul Boddie # Date 1628270696 -7200 # Node ID 84362bb6f6b93d09943588a4c1aa770eb81b785a # Parent aa09cdd2a3bfeaac2c3a27be61b4e2f0f1ed1555 Fixed data_current modification when navigating pipe regions. Added blocking when a pipe region provides no content or space. diff -r aa09cdd2a3bf -r 84362bb6f6b9 libfsclient/lib/src/client.cc --- a/libfsclient/lib/src/client.cc Thu Aug 05 01:31:20 2021 +0200 +++ b/libfsclient/lib/src/client.cc Fri Aug 06 19:24:56 2021 +0200 @@ -59,6 +59,12 @@ if (err) return err; } + + /* Update the current data offset. */ + + file->data_current = position - file->start_pos; + + return L4_EOK; } else { @@ -84,18 +90,8 @@ /* Within the current pipe region, synchronise with the pipe object. */ else - { - err = client_current_region(file); - if (err) - return err; - } + return client_current_region(file); } - - /* Update the current data offset. */ - - file->data_current = position - file->start_pos; - - return L4_EOK; } @@ -105,7 +101,7 @@ static int _operation_blocking(file_t *file, int reading) { - return (file->can_block && ( + return (file->can_block && !(file->notifications & NOTIFY_PEER_CLOSED) && ( (reading && !file_data_available(file)) || (!reading && !file_data_space(file)))); } @@ -123,6 +119,8 @@ while ((err = _access(file, position)) || _operation_blocking(file, reading)) { + position = file->data_current; + /* Exit if blocking is not configured or suitable. */ if ((err && (err != -L4_EBUSY)) || !file->can_block) @@ -132,11 +130,6 @@ if (client_wait_file(file)) return 0; - - /* Handle closure of the object. */ - - if (file->notifications & NOTIFY_PEER_CLOSED) - return 0; } return 1;