tcpdump mailing list archives

Re: How to check if pcap_t is really free?


From: Guy Harris <guy () alum mit edu>
Date: Thu, 20 Jun 2013 12:47:56 -0700


On Jun 20, 2013, at 12:36 PM, Nadav Vinik <nadavvin () gmail com> wrote:

Hoever if I change to pcap_close(&handle) I get the following error:

Because code that passes a pointer to a pointer to a pcap_t, rather than a pointer to a pcap_t, to pcap_close() is 
erroneous code.

You cannot arrange that libpcap somehow make a pcap_t or a pointer to it detectably invalid when you close the handle; 
if you want to know whether a pcap_t has been closed, you will have to make your code explicitly mark it as such.  For 
example, replace all occurrences of

        pcap_close(handle);

in your code with

        pcap_close(handle);
        handle = NULL;
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: