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:
parent
8666f21afc
commit
65f960da71
12
savefile.c
12
savefile.c
|
@ -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
|
||||
|
|
Reference in New Issue