tcpdump mailing list archives

Re: How to check if pcap_t is really free?


From: Nadav Vinik <nadavvin () gmail com>
Date: Thu, 20 Jun 2013 22:36:27 +0300

On 20 June 2013 20:16, Gert Doering <gert () greenie muc de> wrote:

Hi,

On Thu, Jun 20, 2013 at 07:44:00PM +0300, Nadav Vinik wrote:
After pcap_close handle is not NULL  since the following printf is not
print

thanks
Nadav

pcap_close(handle);
        if(handle == NULL) {

In C, this will never ever change the value of "handle", unless
pcap_close() is a macro, which it isn't.

This is not pascal, we have no way for a function to modify it's
arguments silently (you'd need to pass a pointer, &handle, to achiee
that)


thanks

Hoever if I change to pcap_close(&handle) I get the following error:
$ make
gcc ./a.c -lpcap
./a.c: In function ‘main’:
./a.c:53:3: warning: passing argument 1 of ‘pcap_close’ from incompatible
pointer type [enabled by default]
In file included from /usr/include/pcap.h:45:0,
                 from ./a.c:1:
/usr/include/pcap/pcap.h:350:6: note: expected ‘struct pcap_t *’ but
argument is of type ‘struct pcap_t **’


thanks
Nadav



gert

--
USENET is *not* the non-clickable part of WWW!
                                                           //
www.muc.de/~gert/
Gert Doering - Munich, Germany
gert () greenie muc de
fax: +49-89-35655025
gert () net informatik tu-muenchen de




-- 
הבלוג שלי:
http://nadavvin.com
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Current thread: