If we've just done ftruncate, then either we were successful and know
the new file size (and then we don't need an lseek), or we weren't and
then we need to error out anyway.
Doing things this way also avoids another warning in the code.
/* If we created the file, it will be length zero */
if (!lastsize && cancreate) {
- /* we can ignore errors as we recalculate the size */
- ftruncate (fi.fhandle, client->server->expected_size);
- lastsize = size_autodetect(fi.fhandle);
- if (lastsize != client->server->expected_size)
- err("Could not expand file");
+ assert(!multifile);
+ if(ftruncate (fi.fhandle, client->server->expected_size)<0) {
+ err("Could not expand file: %m");
+ }
+ lastsize = client->server->expected_size;
break; /* don't look for any more files */
}