/* dumpcap should be running in capture child mode (hidden feature) */
#ifndef DEBUG_CHILD
argv = sync_pipe_add_arg(argv, &argc, "-Z");
- argv = sync_pipe_add_arg(argv, &argc, "1");
#endif
#ifdef _WIN32
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE; /* this hides the console window */
si.hStdInput = signal_pipe_read;
- si.hStdOutput = sync_pipe_write;
+ si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
si.hStdError = sync_pipe_write;
/*si.hStdError = (HANDLE) _get_osfhandle(2);*/
#endif
* Child process - run dumpcap with the right arguments to make
* it just capture with the specified capture parameters
*/
- eth_close(1);
+ eth_close(2);
dup(sync_pipe[PIPE_WRITE]);
eth_close(sync_pipe[PIPE_READ]);
execv(argv[0], (gpointer)argv);
/* dumpcap should be running in capture child mode (hidden feature) */
#ifndef DEBUG_CHILD
argv = sync_pipe_add_arg(argv, &argc, "-Z");
- argv = sync_pipe_add_arg(argv, &argc, "1");
#endif
return sync_pipe_run_command(argv, msg);
/* dumpcap should be running in capture child mode (hidden feature) */
#ifndef DEBUG_CHILD
argv = sync_pipe_add_arg(argv, &argc, "-Z");
- argv = sync_pipe_add_arg(argv, &argc, "1");
#endif
return sync_pipe_run_command(argv, msg);
/* dumpcap should be running in capture child mode (hidden feature) */
#ifndef DEBUG_CHILD
argv = sync_pipe_add_arg(argv, &argc, "-Z");
- argv = sync_pipe_add_arg(argv, &argc, "1");
#endif
return sync_pipe_open_command(argv, read_fd, fork_child, msg);
void exit_main(int err);
#endif
-/* Sync pipe file descriptor. */
-static int sync_pipe_fd;
static void
print_usage(gboolean print_ver) {
gboolean print_statistics = FALSE;
int status, run_once_args = 0;
-#define OPTSTRING_INIT "a:b:c:Df:hi:LMpSs:vw:y:Z:"
+#define OPTSTRING_INIT "a:b:c:Df:hi:LMpSs:vw:y:Z"
#ifdef _WIN32
#define OPTSTRING_WIN32 "B:"
/*** hidden option: Wireshark child mode (using binary output messages) ***/
case 'Z':
capture_child = TRUE;
- sync_pipe_fd = get_positive_int(optarg, "sync pipe file descriptor");
#ifdef _WIN32
/* set output pipe to binary mode, to avoid ugly text conversions */
- _setmode(sync_pipe_fd, O_BINARY);
+ _setmode(2, O_BINARY);
#endif
break;
if(capture_child) {
g_snprintf(tmp, sizeof(tmp), "%d", packet_count);
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Packets: %s", tmp);
- pipe_write_block(sync_pipe_fd, SP_PACKET_COUNT, tmp);
+ pipe_write_block(2, SP_PACKET_COUNT, tmp);
} else {
count += packet_count;
fprintf(stderr, "\rPackets: %u ", count);
{
if(capture_child) {
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "File: %s", filename);
- pipe_write_block(sync_pipe_fd, SP_FILE, filename);
+ pipe_write_block(2, SP_FILE, filename);
} else {
fprintf(stderr, "File: %s\n", filename);
/* stderr could be line buffered */
{
if (capture_child) {
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Capture filter error: %s", errmsg);
- pipe_write_block(sync_pipe_fd, SP_BAD_FILTER, errmsg);
+ pipe_write_block(2, SP_BAD_FILTER, errmsg);
} else {
fprintf(stderr,
"Invalid capture filter: \"%s\"!\n"
"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(sync_pipe_fd, error_msg, secondary_error_msg);
+ sync_pipe_errmsg_to_parent(2, error_msg, secondary_error_msg);
} else {
fprintf(stderr, "%s\n%s\n", error_msg, secondary_error_msg);
}
if(capture_child) {
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Packets dropped: %s", tmp);
- pipe_write_block(sync_pipe_fd, SP_DROPS, tmp);
+ pipe_write_block(2, SP_DROPS, tmp);
} else {
fprintf(stderr, "Packets dropped: %s\n", tmp);
/* stderr could be line buffered */