3 weeks ago | Paul Boddie | raw files shortlog changelog graph | Fixed the file_data_available result to return zero if the populated span has somehow become less than the current position in the memory region. | |
libfsclient/lib/src/file.cc (file) |
1.1 --- a/libfsclient/lib/src/file.cc Tue Apr 02 23:58:31 2024 +0200 1.2 +++ b/libfsclient/lib/src/file.cc Sat Apr 06 21:52:27 2024 +0200 1.3 @@ -548,7 +548,10 @@ 1.4 1.5 offset_t file_data_available(file_t *file) 1.6 { 1.7 - return file_populated_span(file) - file->data_current; 1.8 + if (file_populated_span(file) > file->data_current) 1.9 + return file_populated_span(file) - file->data_current; 1.10 + else 1.11 + return 0; 1.12 } 1.13 1.14 /* Return the current data offset in the region. */