X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/fc213645d4399c986f1ce3d55e113828e73ee49d..f991a6948dbffc495c7877c404be2d5d4903ea1e:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index e62c2d69..5598ec28 100644 --- 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; @@ -1115,8 +1115,8 @@ main(int argc, char **argv) ndo->ndo_packettype = PT_PGM_ZMTP1; else if (ascii_strcasecmp(optarg, "lmp") == 0) ndo->ndo_packettype = PT_LMP; - else if (strcasecmp(optarg, "resp") == 0) - ndo->ndo_packettype = PT_RESP; + else if (ascii_strcasecmp(optarg, "resp") == 0) + ndo->ndo_packettype = PT_RESP; else error("unknown packet type `%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; @@ -1849,7 +1849,6 @@ main(int argc, char **argv) */ dlt = new_dlt; ndo->ndo_if_printer = get_if_printer(ndo, dlt); - dlt_name = pcap_datalink_val_to_name(dlt); if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0) error("%s", pcap_geterr(pd)); } @@ -1863,6 +1862,7 @@ main(int argc, char **argv) /* * Report the new file. */ + dlt_name = pcap_datalink_val_to_name(dlt); if (dlt_name == NULL) { fprintf(stderr, "reading from file %s, link-type %u\n", RFileName, dlt); @@ -2388,7 +2388,7 @@ print_usage(void) #endif (void)fprintf(stderr, "[ -T type ] [ --version ] [ -V file ]\n"); (void)fprintf(stderr, -"\t\t[ -w file ] [ -W filecount ] [ -y datalinktype ] [ -z command ]\n"); +"\t\t[ -w file ] [ -W filecount ] [ -y datalinktype ] [ -z postrotate-command ]\n"); (void)fprintf(stderr, "\t\t[ -Z user ] [ expression ]\n"); }