dect
/
libpcap
Archived
13
0
Fork 0

Reject attempts to put savefiles into non-blocking mode.

Don't ignore them, reject them, so applications know that non-blocking
mode didn't get turned on, if they're expecting non-blocking reads from
a pipe, for example.
This commit is contained in:
Guy Harris 2010-05-28 20:39:09 -07:00
parent 8666f21afc
commit 65f960da71
1 changed files with 9 additions and 3 deletions

View File

@ -94,10 +94,16 @@ static int
sf_setnonblock(pcap_t *p, int nonblock, char *errbuf)
{
/*
* This is a savefile, not a live capture file, so ignore
* requests to put it in non-blocking mode.
* This is a savefile, not a live capture file, so reject
* requests to put it in non-blocking mode. (If it's a
* pipe, it could be put in non-blocking mode, but that
* would significantly complicate the code to read packets,
* as it would have to handle reading partial packets and
* keeping the state of the read.)
*/
return (0);
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"Savefiles cannot be put into non-blocking mode");
return (-1);
}
static int