tcpdump mailing list archives
Re: if anyone wanted to practice fixing compiler warnings in tcpdump...
From: Denis Ovsienko <denis () ovsienko info>
Date: Mon, 30 Jul 2018 17:48:45 +0100
---- On Mon, 30 Jul 2018 02:08:51 +0100 Guy Harris <gharris () sonic net> wrote ----
On Jul 29, 2018, at 5:48 AM, Denis Ovsienko <denis () ovsienko info> wrote:Building (configure+gcc) tcpdump master branch with libpcap 0.6.1 yields the following compiler warnings, some of which are as easy as decorating a variable declaration with #ifdef: ./tcpdump.c: In function ‘open_interface’: ./tcpdump.c:1382:22: warning: passing argument 1 of ‘pcap_open_live’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] pc = pcap_open_live(device, ndo->ndo_snaplen, !pflag, 1000, ebuf); ^~~~~~ In file included from ./tcpdump.c:97:0: ../libpcap/pcap.h:136:9: note: expected ‘char *’ but argument is of type ‘const char *’ pcap_t *pcap_open_live(char *, int, int, int, char *); ^~~~~~~~~~~~~~Libpcap *should* have had it as const since the beginning, but const was new back when libpcap was introduced; we later added const to a bunch of argument declarations. In this particular case, we could make the argument to open_interface() a "char *" rather than a "const char *" - it's just a routine internal to tcpdump, so it's not as if we're claiming "hey, we might modify this" to code using it.
Well, that, and a comment, looks a little better than a compiler warning.
Thank you for fixing the other warnings. Though I initially hoped some bored hacker would pick the easy warnings first,
then do more difficult ones and eventually warm up to the point where they would close a few bugs on the issue tracker.
My imagination was too powerful this time...
--
Denis Ovsienko
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
Current thread:
- if anyone wanted to practice fixing compiler warnings in tcpdump... Denis Ovsienko (Jul 29)
- Re: if anyone wanted to practice fixing compiler warnings in tcpdump... Guy Harris (Jul 29)
- Re: if anyone wanted to practice fixing compiler warnings in tcpdump... Denis Ovsienko (Jul 30)
- Re: if anyone wanted to practice fixing compiler warnings in tcpdump... Guy Harris (Jul 29)
- Re: if anyone wanted to practice fixing compiler warnings in tcpdump... Guy Harris (Jul 29)
