tcpdump mailing list archives
Re: patch: make tcpdump cleanup on SIGPIPE
From: Guy Harris <guy () alum mit edu>
Date: Tue, 29 Jul 2003 22:58:58 -0700
On Mon, Jul 28, 2003 at 12:48:52PM +1200, Jesper Peterson wrote:
The attached patch
Checked in.
conditionally applies to non-Win32 only, I presume that is the way to do it. I'm not sure exactly what the Win32 implications are.
The Windows NT (NT 4.0, W2K, WXP, etc.) command line supports pipes, and I think the Windows OT (95, 98, Me) command line supports them as well. I don't know whether they're actually implemented *as* pipes, i.e. multiple processes with the output of one sent to an anonymousppppppp pipe which is also the input of another, or whether either NT or OT implements them the way I think they might have been done in at least some versions of the DOS command line, i.e. run the first process and send its output to a file, and then run the second process reading from the file. If they're done as pipes (which I suspect NT might do; OT is another matter, as its command interpreter might be similar to the old DOS one), then it appears from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/writefile.asp that if you write to a pipe that's closed, the WriteFile() call returns an error indication (returns FALSE) and the error value is ERROR_BROKEN_PIPE; this is similar to what happens in UNIX if you're ignoring SIGPIPE. "tcpdump" doesn't check for write errors when printing, and WinDump inherits that, so it'll probably keep writing to the dead pipe, and eventually exit (or get terminated by a SIGINT if you ^C it). If it did check for errors, it'd just exit more quickly. As such, doing the SIGPIPE stuff only on UNIX is probably the right thing to do. - This is the TCPDUMP workers list. It is archived at http://www.tcpdump.org/lists/workers/index.html To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe
Current thread:
- patch: make tcpdump cleanup on SIGPIPE Jesper Peterson (Jul 27)
- Re: patch: make tcpdump cleanup on SIGPIPE Guy Harris (Jul 29)