Don't hardcode the notion that the sync pipe is the standard output into
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 29 Sep 2007 01:15:11 +0000 (01:15 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 29 Sep 2007 01:15:11 +0000 (01:15 +0000)
sync_pipe_errmsg_to_parent(); have it take the FD for the sync pipe as
an argument.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23024 f5534014-38df-0310-8fa8-9805f1628bb7

dumpcap.c
sync_pipe.h
sync_pipe_write.c

index 1d880fec38f8ffc63f99bb577ae7ff01d892b07e..a9c78a32c7937ede44fc3478680498f330c8f475 100644 (file)
--- 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);
     }
index bc063839ae4312962510c5faa5f0ba9413edcdab..51c3cd5fa36ab7c2c845004351b237e840d8c777 100644 (file)
@@ -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 */
index d0def511ced6de3c7b384d52e83ba2fd7a23c632..337e0414b4aec305df1a63f0f532285fd4ae0337 100644 (file)
@@ -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);
 }