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 <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2019-01-23 22:39:22 -08:00
parent 5d38999b57
commit 4f8b3f3d2a
2 changed files with 15 additions and 12 deletions

View File

@ -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;
}
}
}

View File

@ -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.