1.1 --- a/libfsclient/lib/src/client.cc Thu Aug 05 01:31:20 2021 +0200
1.2 +++ b/libfsclient/lib/src/client.cc Fri Aug 06 19:24:56 2021 +0200
1.3 @@ -59,6 +59,12 @@
1.4 if (err)
1.5 return err;
1.6 }
1.7 +
1.8 + /* Update the current data offset. */
1.9 +
1.10 + file->data_current = position - file->start_pos;
1.11 +
1.12 + return L4_EOK;
1.13 }
1.14 else
1.15 {
1.16 @@ -84,18 +90,8 @@
1.17 /* Within the current pipe region, synchronise with the pipe object. */
1.18
1.19 else
1.20 - {
1.21 - err = client_current_region(file);
1.22 - if (err)
1.23 - return err;
1.24 - }
1.25 + return client_current_region(file);
1.26 }
1.27 -
1.28 - /* Update the current data offset. */
1.29 -
1.30 - file->data_current = position - file->start_pos;
1.31 -
1.32 - return L4_EOK;
1.33 }
1.34
1.35
1.36 @@ -105,7 +101,7 @@
1.37
1.38 static int _operation_blocking(file_t *file, int reading)
1.39 {
1.40 - return (file->can_block && (
1.41 + return (file->can_block && !(file->notifications & NOTIFY_PEER_CLOSED) && (
1.42 (reading && !file_data_available(file)) ||
1.43 (!reading && !file_data_space(file))));
1.44 }
1.45 @@ -123,6 +119,8 @@
1.46
1.47 while ((err = _access(file, position)) || _operation_blocking(file, reading))
1.48 {
1.49 + position = file->data_current;
1.50 +
1.51 /* Exit if blocking is not configured or suitable. */
1.52
1.53 if ((err && (err != -L4_EBUSY)) || !file->can_block)
1.54 @@ -132,11 +130,6 @@
1.55
1.56 if (client_wait_file(file))
1.57 return 0;
1.58 -
1.59 - /* Handle closure of the object. */
1.60 -
1.61 - if (file->notifications & NOTIFY_PEER_CLOSED)
1.62 - return 0;
1.63 }
1.64
1.65 return 1;