summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1999-11-21 17:40:26 +0000
committerderaadt <deraadt@openbsd.org>1999-11-21 17:40:26 +0000
commitcfaa9f3e52eb2bb2c060341a9d234d14ed3c576f (patch)
treee47806903a18de0b04261b18ac737a770db34f31 /sys/kern/sys_pipe.c
parentUse mkstemp() for the temp file created in the tabs dir and (diff)
downloadwireguard-openbsd-cfaa9f3e52eb2bb2c060341a9d234d14ed3c576f.tar.xz
wireguard-openbsd-cfaa9f3e52eb2bb2c060341a9d234d14ed3c576f.zip
if select returns writable on a pipe, the write should not return
EWOULDBLOCK. turns out the two checking conditions were not the same, and a certain use of rsync uncovered the bug by chewing all available cpu time; fix from art
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 88472e3169c..8191b931467 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_pipe.c,v 1.20 1999/10/29 14:08:49 art Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.21 1999/11/21 17:40:26 deraadt Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -462,7 +462,8 @@ pipe_write(fp, uio, cred)
if ((space < uio->uio_resid) && (orig_resid <= PIPE_BUF))
space = 0;
- if (space > 0 && (wpipe->pipe_buffer.cnt < PIPE_SIZE)) {
+ if (space > 0 &&
+ (wpipe->pipe_buffer.cnt < wpipe->pipe_buffer.size)) {
/*
* This set the maximum transfer as a segment of
* the buffer.