Module Name:    src
Committed By:   rin
Date:           Thu Oct 15 23:06:06 UTC 2020

Modified Files:
        src/sys/compat/netbsd32: netbsd32_wait.c

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/compat/netbsd32/netbsd32_wait.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/compat/netbsd32/netbsd32_wait.c
diff -u src/sys/compat/netbsd32/netbsd32_wait.c:1.23 src/sys/compat/netbsd32/netbsd32_wait.c:1.24
--- src/sys/compat/netbsd32/netbsd32_wait.c:1.23	Fri Sep 23 14:09:39 2016
+++ src/sys/compat/netbsd32/netbsd32_wait.c	Thu Oct 15 23:06:06 2020
@@ -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 @@ netbsd32___wait450(struct lwp *l, const 
 	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;
 }
 

Reply via email to