From: Eric Biggers Date: Sat, 6 Feb 2016 15:47:14 +0000 (-0600) Subject: write.c: warn if WIM file cannot be truncated X-Git-Tag: v1.9.1~46 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=832b0b2adaf6369d4d686006962206e867ac2a11 write.c: warn if WIM file cannot be truncated Somewhat pointless since this is already an error path, but this avoids a gcc warning about ftruncate()'s return value not being used. --- diff --git a/src/write.c b/src/write.c index 9f48d3f1..cc569395 100644 --- a/src/write.c +++ b/src/write.c @@ -3223,9 +3223,8 @@ out_truncate: WIMLIB_WRITE_FLAG_UNSAFE_COMPACT))) { WARNING("Truncating \"%"TS"\" to its original size " "(%"PRIu64" bytes)", wim->filename, old_wim_end); - /* Return value of ftruncate() is ignored because this is - * already an error path. */ - (void)ftruncate(wim->out_fd.fd, old_wim_end); + if (ftruncate(wim->out_fd.fd, old_wim_end)) + WARNING_WITH_ERRNO("Failed to truncate WIM file!"); } out_restore_hdr: (void)write_wim_header_flags(wim->hdr.flags, &wim->out_fd);