On pipe reads, check for EOF before FNONBLOCK to avoid spurious EAGAIN errors.
This commit is contained in:
parent
e077f7a7d9
commit
d2b7e43b18
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sys_pipe.c,v 1.35 2003/02/12 21:54:16 pk Exp $ */
|
||||
/* $NetBSD: sys_pipe.c,v 1.36 2003/02/14 13:16:44 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -83,7 +83,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.35 2003/02/12 21:54:16 pk Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.36 2003/02/14 13:16:44 pk Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -490,14 +490,6 @@ again:
|
|||
if (nread > 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
* don't block on non-blocking I/O
|
||||
*/
|
||||
if (fp->f_flag & FNONBLOCK) {
|
||||
error = EAGAIN;
|
||||
break;
|
||||
}
|
||||
|
||||
PIPE_LOCK(rpipe);
|
||||
|
||||
/*
|
||||
|
@ -509,6 +501,15 @@ again:
|
|||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* don't block on non-blocking I/O
|
||||
*/
|
||||
if (fp->f_flag & FNONBLOCK) {
|
||||
PIPE_UNLOCK(rpipe);
|
||||
error = EAGAIN;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unlock the pipe buffer for our remaining processing.
|
||||
* We will either break out with an error or we will
|
||||
|
|
Loading…
Reference in New Issue