summaryrefslogtreecommitdiff
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
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 57d8ad74530..1df0c0e4dd3 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_pipe.c,v 1.90 2019/07/09 15:02:15 semarie Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.91 2019/07/13 06:51:59 semarie Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -460,7 +460,8 @@ pipe_write(struct file *fp, struct uio *uio, int fflags)
npipe = atomic_inc_int_nv(&nbigpipe);
if ((npipe <= LIMITBIGPIPES) &&
(error = pipelock(wpipe)) == 0) {
- if (pipespace(wpipe, BIG_PIPE_SIZE) != 0)
+ if ((wpipe->pipe_buffer.cnt != 0) ||
+ (pipespace(wpipe, BIG_PIPE_SIZE) != 0))
atomic_dec_int(&nbigpipe);
pipeunlock(wpipe);
} else