On Thu, Oct 16, 2003 at 07:20:10PM -0600, Craig Davison wrote:
> I noticed that pcap_dump has no (documented) way of reporting I/O errors
> back to the caller.
> 
> However, the user parameter (pcap_dumper_t*) can be casted to type FILE*,
> and passed to ferror() after every call. This allows, for example, disk
> space and large filesize errors to be trapped.
> 
> What do you think about adding a pcap_dump_fileno(pcap_dumper_t*)
> function that returns a FILE *,

The name should probably be "pcap_dump_file()" (by analogy to
"pcap_file()" and "pcap_fileno()").

> so developers don't have to do a nasty
> (and possibly non-portable) cast to check for I/O errors? This is an ideal
> change, as it doesn't involve change the arguments or return values of any
> of the other functions.

True, but it still requires application changes to use it (and thus
either requires that the app have a configure script to see if it *can*
use it or that it be used only with the new version of libpcap).

Given that, I might be inclined to have "pcap_dump_ex()", or something
such as that, which could take a "char *errbuf" and fill in the buffer
with an error string, or have a "pcap_dumper_t" be a structure with a
"FILE *" and an error buffer in it and have a "pcap_dump_geterr()"
routine.
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]

Reply via email to