1.1 --- a/libfsclient/lib/src/client.cc Tue Apr 02 23:17:13 2024 +0200
1.2 +++ b/libfsclient/lib/src/client.cc Tue Apr 02 23:59:13 2024 +0200
1.3 @@ -118,9 +118,11 @@
1.4 }
1.5 else
1.6 {
1.7 + bool initial = (file->memory == NULL);
1.8 +
1.9 /* Handle the initial condition with no current region. */
1.10
1.11 - if (file->memory == NULL)
1.12 + if (initial)
1.13 {
1.14 err = client_current_region(file);
1.15 if (err)
1.16 @@ -150,7 +152,10 @@
1.17
1.18 else
1.19 {
1.20 - return client_current_region(file);
1.21 + if (initial)
1.22 + return L4_EOK;
1.23 + else
1.24 + return client_current_region(file);
1.25 }
1.26 }
1.27 }
1.28 @@ -552,7 +557,17 @@
1.29 if (!client_opened(file))
1.30 return -L4_EINVAL;
1.31
1.32 - return pipe_current(file);
1.33 + long err = pipe_current(file);
1.34 +
1.35 + if (err)
1.36 + return err;
1.37 +
1.38 + /* Handle any case where the current region has been exhausted. */
1.39 +
1.40 + if (!file_populated_span(file))
1.41 + file->data_current = 0;
1.42 +
1.43 + return L4_EOK;
1.44 }
1.45
1.46