aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-11-11 12:31:08 -0800
committerGuy Harris <guy@alum.mit.edu>2019-11-11 21:12:34 +0000
commit560f2e54ba4848fe1b776b29a3d63c2af192a0db (patch)
tree52b568315d1d6af73f8b81215232a347108a20f4 /tshark.c
parent7cbe0b2e1580686af3e13df83577cc581668950e (diff)
Don't report EPIPE errors writing out packet information.
EPIPE almost certainly means "the next program after us in the pipeline exited before we were finished writing", so this isn't a real error, it just means we're done. (We don't get SIGPIPE because libwireshark ignores SIGPIPE to avoid getting killed if writing to the MaxMind process gets SIGPIPE because that process died.) Presumably either that program exited deliberately (for example, "head -N" read N lines and printed them), in which case there's no error to report, or it terminated due to an error or a signal, in which case *that's* the error and that error has been reported. (We don't do that for EINVAL, as that's presumably a real error. It shows up on Windows in bug 16192, but what we probably want to do there is to, on Windows, use _doserrno, check for the equivalent Windows errors, and, for the default case, convert _doserrno to the appropriate string, using Windows APIs, and report *that* string; the MS C library converts a whole bunch of Windows errors to EINVAL, thus losing information and making it harder to determine what the real error is. Therefore, I'm just marking this with Ping-Bug, as it's only fixing the problem on UN*Xes.) Change-Id: I94c392f478561e29501facd657487716a5882295 Ping-Bug: 16192 Reviewed-on: https://code.wireshark.org/review/35053 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tshark.c b/tshark.c
index 0ce256c3d7..1ed0b065b7 100644
--- a/tshark.c
+++ b/tshark.c
@@ -4318,6 +4318,23 @@ show_print_file_io_error(int err)
break;
#endif
+ case EPIPE:
+ /*
+ * This almost certainly means "the next program after us in
+ * the pipeline exited before we were finished writing", so
+ * this isn't a real error, it just means we're done. (We
+ * don't get SIGPIPE because libwireshark ignores SIGPIPE
+ * to avoid getting killed if writing to the MaxMind process
+ * gets SIGPIPE because that process died.)
+ *
+ * Presumably either that program exited deliberately (for
+ * example, "head -N" read N lines and printed them), in
+ * which case there's no error to report, or it terminated
+ * due to an error or a signal, in which case *that's* the
+ * error and that error has been reported.
+ */
+ break;
+
default:
cmdarg_err("An error occurred while printing packets: %s.",
g_strerror(err));