]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Don't accept zero -C or -W options 526/head
authorJamie Bainbridge <[email protected]>
Wed, 29 Jun 2016 23:15:33 +0000 (09:15 +1000)
committerGitHub <[email protected]>
Wed, 29 Jun 2016 23:15:33 +0000 (09:15 +1000)
Rolling over into zero filesize makes no sense. Creating a rotating
buffer of zero files makes no sense.

Modify the checks for -C and -W to accept greater than one, not greater
than zero.

Signed-off-by: Jamie Bainbridge <[email protected]>
tcpdump.c

index 1db35daafd5837f6a26ada69e1d6d5d06d593da8..282d44c96ffa88a3d3467101aa9cc63147cc7eae 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -864,7 +864,7 @@ main(int argc, char **argv)
 
                case 'C':
                        Cflag = atoi(optarg) * 1000000;
-                       if (Cflag < 0)
+                       if (Cflag <= 0)
                                error("invalid file size %s", optarg);
                        break;
 
@@ -1145,7 +1145,7 @@ main(int argc, char **argv)
 
                case 'W':
                        Wflag = atoi(optarg);
-                       if (Wflag < 0)
+                       if (Wflag <= 0)
                                error("invalid number of output files %s", optarg);
                        WflagChars = getWflagChars(Wflag);
                        break;