[ovs-dev] [PATCH] pcap-file: Correctly format enum type.

Ben Pfaff blp at ovn.org
Fri Nov 16 17:25:11 UTC 2018


The underlying type for an enum is somewhat unpredictable in that the
compiler and the ABI influence it.  The format specifier I used here was
apparently correct for i386 on Linux but wrong for x86-64.  It's better to
just use a cast.

Reported-by: Simon Horman <simon.horman at netronome.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/pcap-file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pcap-file.c b/lib/pcap-file.c
index 863a9a6c7bf2..e4e92b8c20ef 100644
--- a/lib/pcap-file.c
+++ b/lib/pcap-file.c
@@ -153,8 +153,8 @@ ovs_pcap_read_header(struct pcap_file *p_file)
     p_file->network = byte_swap ? uint32_byteswap(ph.network) : ph.network;
     if (p_file->network != PCAP_ETHERNET &&
         p_file->network != PCAP_LINUX_SLL) {
-        VLOG_WARN("unknown network type %"PRIu16" reading pcap file",
-                  p_file->network);
+        VLOG_WARN("unknown network type %u reading pcap file",
+                  (unsigned int) p_file->network);
         return EPROTO;
     }
     return 0;
-- 
2.16.1



More information about the dev mailing list