tcpdump mailing list archives
Re: libpcap doesn't close filter-file
From: Guy Harris <gharris () sonic net>
Date: Sat, 8 Feb 2003 13:10:13 -0800
On Sat, Feb 08, 2003 at 02:59:27PM +0100, Gisle Vanem wrote:
Attached is a patch that adds a close(), fixes the file-mode and allows comments in the filter-expression file. +#if defined(WIN32) || defined(MSDOS) + int mode = _fmode; + _fmode = O_BINARY; /* DOS/Win32 defaults to O_TEXT */ fd = open(fname, O_RDONLY); + _fmode = mode; +#else + fd = open(fname, O_RDONLY); +#endif +
Is "_fmode" some kind of global on Windows? Does #ifndef O_BINARY #define O_BINARY 0 /* UNIX */ #endif ... fd = open(fname, O_RDONLY|O_BINARY); also work? (That's what we do in Ethereal to open files in binary mode.) It seems a bit cleaner.
Also need this patch in libpcap: ------------------------------------------- --- ./scanner.l.orig Fri Dec 6 00:01:36 2002 +++ ./scanner.l Sat Feb 8 14:58:28 2003 @@ -276,7 +276,7 @@ connectmsg return CONNECTMSG; metaconnect return METACONNECT; -[ \n\t] ; +[ \r\n\t] ;
In another thread you said Exactly. scanner.l doesn't understand '\'r' in line-endings. I tried to modify scanner.l to say "[ \r\n\t] ;" instead of "[ \n\t] ;", but that didn't work. So I modified read_infile() to strip all CR and LF from buffer and now it works. so does that now work? - 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:
- libpcap doesn't close filter-file Gisle Vanem (Feb 07)
- Re: libpcap doesn't close filter-file Guy Harris (Feb 07)
- Re: libpcap doesn't close filter-file Gisle Vanem (Feb 08)
- Re: libpcap doesn't close filter-file Guy Harris (Feb 08)
- Re: libpcap doesn't close filter-file Gisle Vanem (Feb 08)
- Re: libpcap doesn't close filter-file Guy Harris (Feb 08)
- Re: libpcap doesn't close filter-file Gisle Vanem (Feb 08)
- Re: libpcap doesn't close filter-file Guy Harris (Feb 07)