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
This commit is contained in:
parent
343fa12c82
commit
6d065e2eb2
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue