]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix a warning
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 21 Jul 2019 13:56:10 +0000 (15:56 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 21 Jul 2019 14:09:05 +0000 (16:09 +0200)
./tcpdump.c:1731:23: warning: implicit conversion loses integer precision:
  'long' to 'int' [-Wshorten-64-to-32]
                        ndo->ndo_snaplen = strtol(optarg, &end, 0);
                                         ~ ^~~~~~~~~~~~~~~~~~~~~~~

tcpdump.c

index 53164a7f20f601e4c3c1027c3bb65f22194e3ef7..c9ce7fcddedffb4b1ba5c22dc5f54f2c582db05a 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1728,7 +1728,7 @@ main(int argc, char **argv)
                        break;
 
                case 's':
-                       ndo->ndo_snaplen = strtol(optarg, &end, 0);
+                       ndo->ndo_snaplen = (int)strtol(optarg, &end, 0);
                        if (optarg == end || *end != '\0'
                            || ndo->ndo_snaplen < 0 || ndo->ndo_snaplen > MAXIMUM_SNAPLEN)
                                error("invalid snaplen %s (must be >= 0 and <= %d)",