Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 wait4(2): make error paths match with th...



details:   https://anonhg.NetBSD.org/src/rev/96e8f5761728
branches:  trunk
changeset: 1015152:96e8f5761728
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Oct 15 23:06:06 2020 +0000

description:
wait4(2): make error paths match with that of native wait4(2):

https://nxr.netbsd.org/xref/src/sys/kern/kern_exit.c#720

diffstat:

 sys/compat/netbsd32/netbsd32_wait.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r 40b2bb9a6100 -r 96e8f5761728 sys/compat/netbsd32/netbsd32_wait.c
--- a/sys/compat/netbsd32/netbsd32_wait.c       Thu Oct 15 22:59:50 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_wait.c       Thu Oct 15 23:06:06 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_wait.c,v 1.23 2016/09/23 14:09:39 skrll Exp $ */
+/*     $NetBSD: netbsd32_wait.c,v 1.24 2020/10/15 23:06:06 rin Exp $   */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_wait.c,v 1.23 2016/09/23 14:09:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_wait.c,v 1.24 2020/10/15 23:06:06 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -66,14 +66,15 @@
        if (pid == 0)
                return error;
 
-       if (SCARG_P32(uap, rusage)) {
+       if (SCARG_P32(uap, status))
+               error = copyout(&status, SCARG_P32(uap, status),
+                   sizeof(status));
+
+       if (SCARG_P32(uap, rusage) && error == 0) {
                netbsd32_from_rusage(&ru, &ru32);
                error = copyout(&ru32, SCARG_P32(uap, rusage), sizeof(ru32));
        }
 
-       if (error == 0 && SCARG_P32(uap, status))
-               error = copyout(&status, SCARG_P32(uap, status), sizeof(status));
-
        return error;
 }
 



Home | Main Index | Thread Index | Old Index