tcpdump mailing list archives

Re: savefile.c patch


From: Guy Harris <guy () alum mit edu>
Date: Wed, 26 May 2004 14:35:01 -0700


On May 26, 2004, at 2:16 PM, Gisle Vanem wrote:

I wasn't sure why either. Maybe reducing the chance of a file with
truncated packets. I just moved setbuf() further up.

Actually, you moved the "if (f == NULL)" check down, leaving the "setbuf()" where it was, and also removed the "#ifdef WIN32"/"#endif" around the "setbuf()".

That means the "setbuf()" will be done on UN*X as well - and also means that it'll try to do the "setbuf()" even if the "fopen()" fails, which will probably crash the program when it tries to dereference a null pointer.

Also, that means that if it's writing to the standard output it won't do a "setbuf()" even on Windows.

-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.


Current thread: