tshark/wireshark: Fix check ring buffer option for packets

tshark and wireshark did not allow only -b packets:value option, while dumpcap does.
This change adds the same check in tshark and wireshark as in dumpcap.

Quick fix for issue mentioned at https://ask.wireshark.org/question/23437/why-does-tshark-b-packetsvalue-not-work/


(cherry picked from commit 9f8e6b1acb)
This commit is contained in:
Andre Luyer 2021-07-04 17:43:02 +02:00 committed by Guy Harris
parent bf35c11265
commit 3afd332455
2 changed files with 6 additions and 4 deletions

View File

@ -1794,9 +1794,10 @@ main(int argc, char *argv[])
} }
if (!global_capture_opts.has_autostop_filesize && if (!global_capture_opts.has_autostop_filesize &&
!global_capture_opts.has_file_duration && !global_capture_opts.has_file_duration &&
!global_capture_opts.has_file_interval) { !global_capture_opts.has_file_interval &&
!global_capture_opts.has_file_packets) {
cmdarg_err("Multiple capture files requested, but " cmdarg_err("Multiple capture files requested, but "
"no maximum capture file size, duration or interval was specified."); "no maximum capture file size, duration, interval or packets were specified.");
exit_status = INVALID_OPTION; exit_status = INVALID_OPTION;
goto clean_exit; goto clean_exit;
} }

View File

@ -670,8 +670,9 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
} }
if (!global_capture_opts.has_autostop_filesize && if (!global_capture_opts.has_autostop_filesize &&
!global_capture_opts.has_file_duration && !global_capture_opts.has_file_duration &&
!global_capture_opts.has_file_interval) { !global_capture_opts.has_file_interval &&
cmdarg_err("Ring buffer requested, but no maximum capture file size, duration or interval were specified."); !global_capture_opts.has_file_packets) {
cmdarg_err("Ring buffer requested, but no maximum capture file size, duration, interval or packets were specified.");
/* XXX - this must be redesigned as the conditions changed */ /* XXX - this must be redesigned as the conditions changed */
} }
} }