iron out extra compiler warnings
[project/fwtool.git] / fwtool.c
index 89e89514ad35f4539b55cc9eddc9d977871e22cc..c059331ad2317a62dd2b3ac4ab24e2dc262448d2 100644 (file)
--- 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)