- Original Message -
From: "ury segal" <[EMAIL PROTECTED]>
To: tcpdump-workers@lists.tcpdump.org
Subject: Re: [tcpdump-workers] pcap_loop segfaults
Date: Sun, 19 Jun 2005 02:22:48 -0400 (EDT)
>
> Just to same you some pain, here is another
> error in your program: Look at your die()
> fu
Just to same you some pain, here is another
error in your program: Look at your die()
function:
void die (_Bool onoff, char *text, ...) {
va_list(args);
va_start(args, text);
vfprintf(stderr, text, args);
va_end(args);
fflush(stdout);
if (errno &&
Your error was that you did not save the
return value from pcap_open_live. It's not
related to the ! operator. You can keep on
using ! if you want.
Change your original errornous
> if (!(pcap_open_live(iface, snaplen, 0, -1,
errbuf)))
to
if (! (pfd = pcap_open_live(iface, snaplen, 0, -1,
errbuf))
it may seem odd that I used !(function), I come to C as a perl coder and to me
this is the logical way to do it, if (!(open_door)) { die "door locked?" }
would seem to me (in a linguistical aspect) correct, basicly "if not open door,
tell is locked and exit", whereas != NULL is just plain techni
odd, yet this yas seemed to fix it, much thanks.
- Original Message -
From: "alexander medvedev" <[EMAIL PROTECTED]>
To: tcpdump-workers@lists.tcpdump.org
Subject: Re: [tcpdump-workers] pcap_loop segfaults
Date: Sat, 18 Jun 2005 23:26:20 -0500 (CDT)
>
> hallo,
>
> i didn't go into much
hallo,
i didn't go into much detail but for a start:
i'd make "pcap_t *pfd" global and change:
if (!(pcap_open_live(iface, snaplen, 0, -1, errbuf)))
to
if ((pfd = pcap_open_live(iface, snaplen, 0, -1, errbuf)) != NULL)
this should get you started :-)
good luck,
-alexm
23:16 18/06/2005
On Sun,
Hello, i'm attempting my first pcap capture, but pcap_loop segfaults, and i'm
not quite sure why:
-- begin ./sniff output --
xzziroz:/home/kspecial# ./sniff
-> successfuly listening on iterface 'eth0'
Segmentation fault
xzziroz:/home/kspecial# gdb sniff
GNU gdb 6.3-debian
Copyright 2004 Free Sof