]> The Tcpdump Group git mirrors - libpcap/commitdiff
Squelch a narrowing warning
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 23 Jun 2021 11:53:18 +0000 (13:53 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 23 Jun 2021 12:10:16 +0000 (14:10 +0200)
Ignore the warning in the way to enable build with -Werror.

To be look at before 2038...

The warning was (clang 64 bits):
./pcap-netfilter-linux.c:346:12: warning: implicit conversion loses
integer precision: 'time_t' (aka 'long') to 'unsigned int'
[-Wshorten-64-to-32]
                seq_id = time(NULL);
                       ~ ^~~~~~~~~~

pcap-netfilter-linux.c

index 17f528fc0783fadb62ed9111d903b12e52870496..d9550b02d399792b514eef51b3dbcdefa03da16d 100644 (file)
@@ -33,6 +33,7 @@
 #endif
 
 #include "pcap-int.h"
+#include "diag-control.h"
 
 #ifdef NEED_STRERROR_H
 #include "strerror.h"
@@ -343,7 +344,9 @@ netfilter_send_config_msg(const pcap_t *handle, uint16_t msg_type, int ack, u_in
        static unsigned int seq_id;
 
        if (!seq_id)
+DIAG_OFF_NARROWING
                seq_id = time(NULL);
+DIAG_ON_NARROWING
        ++seq_id;
 
        nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg));