NetBSD-Bugs archive

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

kern/45423: the actual error from pipe_create() should be used instead of being rewritten

>Number:         45423
>Category:       kern
>Synopsis:       the actual error from pipe_create() should be used instead of 
>being rewritten
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 04 18:50:00 +0000 2011
>Originator:     Greg A. Woods
>Release:        NetBSD-current 2011/10/04
Planix, Inc.; Kelowna, BC; Canada
System: NetBSD
Architecture: all
Machine: all

        One should use the actual error result from an internal helper
        function that carefully returns proper error codes instead of
        rewriting any error to some (other) hard-coded value.

        In this case there is currently only one possible error that can
        be returned by pipe_create() and it matches what is returned by
        its caller, but I think it's important not to unilaterally
        ignore future possible errors by unilaterally rewriting the



Index: sys/kern/sys_pipe.c
RCS file: /cvs/master/m-NetBSD/main/src/sys/kern/sys_pipe.c,v
retrieving revision 1.132
diff -u -r1.132 sys_pipe.c
--- sys/kern/sys_pipe.c 15 Jul 2011 14:50:19 -0000      1.132
+++ sys/kern/sys_pipe.c 4 Oct 2011 18:02:42 -0000
@@ -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