mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0007-cat-Fix-GCC-10-warning.patch

5ce0c7
From 93422725a0a8248d97b67cdbc20e065f5164e089 Mon Sep 17 00:00:00 2001
5ce0c7
From: "Richard W.M. Jones" <rjones@redhat.com>
5ce0c7
Date: Thu, 6 Feb 2020 10:27:48 +0000
5ce0c7
Subject: [PATCH] cat: Fix GCC 10 warning.
5ce0c7
5ce0c7
I believe this warning is bogus, but simply initializing the local
5ce0c7
variable is enough to avoid it.
5ce0c7
5ce0c7
log.c: In function 'do_log':
5ce0c7
log.c:390:7: error: 'comm_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
5ce0c7
  390 |       printf (" %.*s", (int) comm_len, comm);
5ce0c7
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5ce0c7
5ce0c7
(cherry picked from commit 4e199494c41d3240aa5c0708887b7a7513c6b6f2)
5ce0c7
---
5ce0c7
 cat/log.c | 2 +-
5ce0c7
 1 file changed, 1 insertion(+), 1 deletion(-)
5ce0c7
5ce0c7
diff --git a/cat/log.c b/cat/log.c
5ce0c7
index 25107e25f..f8a5c85f2 100644
5ce0c7
--- a/cat/log.c
5ce0c7
+++ b/cat/log.c
5ce0c7
@@ -337,7 +337,7 @@ do_log_journal (void)
5ce0c7
   while ((r = guestfs_journal_next (g)) > 0) {
5ce0c7
     CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
5ce0c7
     const char *priority_str, *identifier, *comm, *pid, *message;
5ce0c7
-    size_t priority_len, identifier_len, comm_len, pid_len, message_len;
5ce0c7
+    size_t priority_len, identifier_len, comm_len = 0, pid_len, message_len;
5ce0c7
     int priority = LOG_INFO;
5ce0c7
     int64_t ts;
5ce0c7
 
5ce0c7
-- 
5ce0c7
2.18.4
5ce0c7