mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
Fix bug: a read() on a bpf device which was in non-blocking mode
and had no data available returned 0. Now it returns -1 with errno set to EWOULDBLOCK (== EAGAIN) as it should. This fix makes the bpf device usable in threaded programs. Reviewed by: bde
This commit is contained in:
parent
61ffadb185
commit
fba3cfdef2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=70127
@ -500,11 +500,12 @@ bpfread(dev, uio, ioflag)
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
if (ioflag & IO_NDELAY)
|
||||
error = EWOULDBLOCK;
|
||||
else
|
||||
error = BPF_SLEEP((caddr_t)d, PRINET|PCATCH, "bpf",
|
||||
d->bd_rtout);
|
||||
if (ioflag & IO_NDELAY) {
|
||||
splx(s);
|
||||
return (EWOULDBLOCK);
|
||||
}
|
||||
error = BPF_SLEEP((caddr_t)d, PRINET|PCATCH, "bpf",
|
||||
d->bd_rtout);
|
||||
if (error == EINTR || error == ERESTART) {
|
||||
splx(s);
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user