Found via -Werror:

  makedumpfile.c: In function ‘dump_dmesg’:
  makedumpfile.c:5884:33: error: ignoring return value of ‘ftruncate’ declared 
with attribute ‘warn_unused_result’ [-Werror=unused-result]
   5884 |                                 ftruncate(info->fd_dumpfile, 0);
        |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stefan Wiehler <stefan.wieh...@nokia.com>
---
 makedumpfile.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index ce0d40e..c6f70ff 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -5881,7 +5881,11 @@ dump_dmesg()
                                char *first;
 
                                /* Clear everything we have already written... 
*/
-                               ftruncate(info->fd_dumpfile, 0);
+                               if (ftruncate(info->fd_dumpfile, 0) != 0) {
+                                       ERRMSG("Can't truncate file(%s). %s\n",
+                                              info->name_dumpfile, 
strerror(errno));
+                                       goto out;
+                               }
                                lseek(info->fd_dumpfile, 0, SEEK_SET);
 
                                /* ...and only write up to the corruption. */
-- 
2.42.0


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to