On Thu, Jan 25, 2001 at 10:03:36AM -0500, Michael T. Stolarchuk wrote:
> According to the (most recent) man page:
> pcap_fileno() returns the file descriptor number of the ``savefile.''
>
> Yet, what really happens is when you're pcap_open_live,
> pcap_fileno() really does return the fd, but if you're
> pcap_open_offline, pcap_fileno() return -1.
>
> savefile.c:332
> /*
> * Set this field so we don't close stdin in pcap_close!
> */
> p->fd = -1;
>
> So pcap_fileno() returns -1 when using a savefile, and returns
> the fd of the sniffing stream when pcap_open_live is called.
I'm not sure how many things are useful to do on the underlying file
descriptor regardless of whether it's a live capture or a file. Unless
there are such things, the program can, if if it's working on a file,
use "pcap_file()" to get the "FILE *" and then use "fileno()" on that to
get the file descriptor.
As such, I'm not sure it's worth changing "pcap_fileno()", but it is
worth changing the man page (which I think always incorrectly claimed it
was the file descriptor of a savefile rather than of a capture
device/socket/etc.).
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe