1.1 --- a/libfsclient/lib/src/client.cc Sun Apr 18 00:26:47 2021 +0200
1.2 +++ b/libfsclient/lib/src/client.cc Sun Apr 18 00:27:43 2021 +0200
1.3 @@ -200,6 +200,11 @@
1.4 if (file == NULL)
1.5 return 0;
1.6
1.7 + /* Map memory if none has been mapped so far. */
1.8 +
1.9 + if ((file->memory == NULL) && (client_mmap(file, client_tell(file), count) == NULL))
1.10 + return 0;
1.11 +
1.12 /* Amount available in the descriptor buffer already. */
1.13
1.14 offset_t available = file_data_available(file);
1.15 @@ -334,6 +339,11 @@
1.16 if (file == NULL)
1.17 return 0;
1.18
1.19 + /* Map memory if none has been mapped so far. */
1.20 +
1.21 + if ((file->memory == NULL) && (client_mmap(file, client_tell(file), count) == NULL))
1.22 + return 0;
1.23 +
1.24 /* Attempt to ensure that the file can accept the amount of data to be
1.25 written. This may not resize to the needed amount if a file has a fixed
1.26 size, but data will still be written to any available space. */