From 4f8b3f3d2a76d9afe9021dcb70f9abea5f595201 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 23 Jan 2019 22:39:22 -0800 Subject: [PATCH] By default, don't stop after a read error. For close to 10 years, we have defaulted not to stop processing on an open error; default not to stop processing on a read error, either. -C causes us to stop for both. Bug: 15433 Change-Id: I5cd239c160d0ff85eb0425ca4b172532a4659fd3 Reviewed-on: https://code.wireshark.org/review/31710 Reviewed-by: Guy Harris --- capinfos.c | 15 ++++++++------- doc/capinfos.pod | 12 +++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/capinfos.c b/capinfos.c index afab0dbac4..72fb14a6a5 100644 --- a/capinfos.c +++ b/capinfos.c @@ -88,14 +88,14 @@ /* * By default capinfos now continues processing * the next filename if and when wiretap detects - * a problem opening a file. + * a problem opening or reading a file. * Use the '-C' option to revert back to original * capinfos behavior which is to abort any - * additional file processing at first open file - * failure. + * additional file processing at the first file + * open or read failure. */ -static gboolean stop_after_wtap_open_offline_failure = FALSE; +static gboolean stop_after_failure = FALSE; /* * table report variables @@ -1561,7 +1561,7 @@ main(int argc, char *argv[]) break; case 'C': - stop_after_wtap_open_offline_failure = TRUE; + stop_after_failure = TRUE; break; case 'A': @@ -1679,7 +1679,7 @@ main(int argc, char *argv[]) if (!wth) { cfile_open_failure_message("capinfos", argv[opt], err, err_info); overall_error_status = 2; /* remember that an error has occurred */ - if (stop_after_wtap_open_offline_failure) + if (stop_after_failure) goto exit; } @@ -1691,7 +1691,8 @@ main(int argc, char *argv[]) wtap_close(wth); if (status) { overall_error_status = status; - goto exit; + if (stop_after_failure) + goto exit; } } } diff --git a/doc/capinfos.pod b/doc/capinfos.pod index 32c8274c4d..62539df56a 100644 --- a/doc/capinfos.pod +++ b/doc/capinfos.pod @@ -124,13 +124,15 @@ Displays the number of packets in the capture file. =item -C Cancel processing any additional files if and -when capinfos should fail to open an input file. -By default capinfos will attempt to open each and -every file name argument. +when capinfos fails to open an input file +or gets an error reading an input file. +By default capinfos will continue processing files +even if it gets an error opening or reading a file. Note: An error message will be written to stderr -whenever capinfos fails to open a file regardless -of whether the -C option is specified or not. +whenever capinfos fails to open a file or gets +an error reading from a file regardless whether +the -C option is specified or not. Upon exit, capinfos will return an error status if any errors occurred during processing.