From e43042507b4f542e88e10ceaae2ca7bbaef6b1d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Thu, 17 Oct 2019 15:08:15 +0200 Subject: [PATCH] iron out extra compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit fwtool.c:216:3: error: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Werror=unused-result] fwtool.c:376:3: error: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Werror=unused-result] Signed-off-by: Petr Štetiar --- fwtool.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fwtool.c b/fwtool.c index 89e8951..c059331 100644 --- a/fwtool.c +++ b/fwtool.c @@ -213,7 +213,9 @@ add_data(const char *name) if (ret) { fflush(firmware_file); - ftruncate(fileno(firmware_file), file_len); + ret = ftruncate(fileno(firmware_file), file_len); + if (ret < 0) + msg("Error during ftruncate: %m\n"); } return ret; @@ -374,8 +376,13 @@ extract_data(const char *name) } } - if (!ret && truncate_file) - ftruncate(fileno(firmware_file), dbuf.file_len); + if (!ret && truncate_file) { + ret = ftruncate(fileno(firmware_file), dbuf.file_len); + if (ret < 0) { + msg("Error during ftruncate: %m\n"); + goto out; + } + } if (write_truncated) { if (dbuf.prev) -- 2.30.2