From 832b0b2adaf6369d4d686006962206e867ac2a11 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 6 Feb 2016 09:47:14 -0600 Subject: [PATCH] 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. --- src/write.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); -- 2.43.0