From 6d065e2eb2792e6b4add180d7ac6190ecff3f925 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 29 Sep 2007 01:15:11 +0000 Subject: [PATCH] Don't hardcode the notion that the sync pipe is the standard output into sync_pipe_errmsg_to_parent(); have it take the FD for the sync pipe as an argument. svn path=/trunk/; revision=23024 --- dumpcap.c | 2 +- sync_pipe.h | 5 +++-- sync_pipe_write.c | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dumpcap.c b/dumpcap.c index 1d880fec38..a9c78a32c7 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -600,7 +600,7 @@ report_capture_error(const char *error_msg, const char *secondary_error_msg) "Primary Error: %s", error_msg); g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Secondary Error: %s", secondary_error_msg); - sync_pipe_errmsg_to_parent(error_msg, secondary_error_msg); + sync_pipe_errmsg_to_parent(1, error_msg, secondary_error_msg); } else { fprintf(stderr, "%s\n%s\n", error_msg, secondary_error_msg); } diff --git a/sync_pipe.h b/sync_pipe.h index bc063839ae..51c3cd5fa3 100644 --- a/sync_pipe.h +++ b/sync_pipe.h @@ -1,5 +1,6 @@ /* sync_pipe.h - * Low-level synchronization pipe routines for use by Wireshark and dumpcap + * Low-level synchronization pipe routines for use by Wireshark/TShark + * and dumpcap * * $Id$ * @@ -73,7 +74,7 @@ pipe_write_block(int pipe, char indicator, const char *msg); /** the child encountered an error, notify the parent */ extern void -sync_pipe_errmsg_to_parent(const char *error_msg, +sync_pipe_errmsg_to_parent(int pipe, const char *error_msg, const char *secondary_error_msg); #endif /* sync_pipe.h */ diff --git a/sync_pipe_write.c b/sync_pipe_write.c index d0def511ce..337e0414b4 100644 --- a/sync_pipe_write.c +++ b/sync_pipe_write.c @@ -104,11 +104,12 @@ pipe_write_block(int pipe, char indicator, const char *msg) void -sync_pipe_errmsg_to_parent(const char *error_msg, const char *secondary_error_msg) +sync_pipe_errmsg_to_parent(int pipe, const char *error_msg, + const char *secondary_error_msg) { /* first write a "master header" with the length of the two messages plus their "slave headers" */ - pipe_write_header(1, SP_ERROR_MSG, strlen(error_msg) + 1 + 4 + strlen(secondary_error_msg) + 1 + 4); - pipe_write_block(1, SP_ERROR_MSG, error_msg); - pipe_write_block(1, SP_ERROR_MSG, secondary_error_msg); + pipe_write_header(pipe, SP_ERROR_MSG, strlen(error_msg) + 1 + 4 + strlen(secondary_error_msg) + 1 + 4); + pipe_write_block(pipe, SP_ERROR_MSG, error_msg); + pipe_write_block(pipe, SP_ERROR_MSG, secondary_error_msg); }