Add a new global flag "capture_child", which is TRUE if we're a child
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 30 Sep 1999 06:50:01 +0000 (06:50 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 30 Sep 1999 06:50:01 +0000 (06:50 +0000)
commit12560fdd8b40cffea0d3e2b8683c60260a93bb1d
tree598656f67b782d216a43b74971951a4bf69012f0
parent00a908da798e235c4b6c9ef100dac5daa5365620
Add a new global flag "capture_child", which is TRUE if we're a child
process for a sync mode or fork mode capture.

Have that flag control whether we do things that *only* the parent or
*only* the child should do, rather than basing it solely on the setting
of "sync_mode" or "fork_mode" (or, in the case of stuff done in the
child process either in sync mode or fork mode, rather than basing it on
the setting of those flags at all).

Split "do_capture()" into a "run_capture()" routine that starts a
capture (possibly by forking off and execing a child process, if we're
supposed to do sync mode or fork mode captures), and that assumes the
file to which the capture is to write has already been opened and that
"cf.save_file_fd" is the file descriptor for that file, and a
"do_capture()" routine that creates a temporary file, getting an FD for
it, and calls "run_capture()".

Use "run_capture()", rather than "capture()", for "-k" captures, so that
it'll do the capture in a child process if "-S" or "-F" was specified
("do_capture()" won't do because "-k" captures should write to the file
specified by the "-w" flag, not some random temporary file).

For child process captures, however, just use "capture()" - the child
process shouldn't itself fork off a child if we're in sync or fork mode,
and should just write to the file whose file descriptor was specified by
the "-W" flag on the command line.

All this allows you to do "ethereal -S -w <file> -i <interface> -k" to
start a sync mode capture from the command line.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@740 f5534014-38df-0310-8fa8-9805f1628bb7
capture.c
capture.h
globals.h
gtk/main.c