Module Name: src
Committed By: apb
Date: Wed Oct 5 13:30:24 UTC 2011
Modified Files:
src/sys/kern: sys_pipe.c
Log Message:
When pipe1() calls pipe_create() and it fails, use the error
result from pipe_create(), don't assume it will always be ENOMEM.
>From PR 45423 by Greg Woods.
To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/kern/sys_pipe.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/sys_pipe.c
diff -u src/sys/kern/sys_pipe.c:1.132 src/sys/kern/sys_pipe.c:1.133
--- src/sys/kern/sys_pipe.c:1.132 Fri Jul 15 14:50:19 2011
+++ src/sys/kern/sys_pipe.c Wed Oct 5 13:30:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_pipe.c,v 1.132 2011/07/15 14:50:19 christos Exp $ */
+/* $NetBSD: sys_pipe.c,v 1.133 2011/10/05 13:30:24 apb Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.132 2011/07/15 14:50:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.133 2011/10/05 13:30:24 apb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -255,9 +255,8 @@ pipe1(struct lwp *l, register_t *retval,
return EINVAL;
p = curproc;
rpipe = wpipe = NULL;
- if (pipe_create(&rpipe, pipe_rd_cache) ||
- pipe_create(&wpipe, pipe_wr_cache)) {
- error = ENOMEM;
+ if ((error = pipe_create(&rpipe, pipe_rd_cache)) ||
+ (error = pipe_create(&wpipe, pipe_wr_cache))) {
goto free2;
}
rpipe->pipe_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);