Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern When pipe1() calls pipe_create() and it fails, use ...



details:   https://anonhg.NetBSD.org/src/rev/c544e61ff5f0
branches:  trunk
changeset: 770143:c544e61ff5f0
user:      apb <apb%NetBSD.org@localhost>
date:      Wed Oct 05 13:30:24 2011 +0000

description:
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.

diffstat:

 sys/kern/sys_pipe.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r 0f43e43f4819 -r c544e61ff5f0 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c       Wed Oct 05 13:24:09 2011 +0000
+++ b/sys/kern/sys_pipe.c       Wed Oct 05 13:30:24 2011 +0000
@@ -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 @@
                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);



Home | Main Index | Thread Index | Old Index