Module Name:    src
Committed By:   christos
Date:           Sun Apr  3 01:49:51 UTC 2016

Modified Files:
        src/lib/libc/gen: waitid.c

Log Message:
simplify


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/waitid.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/waitid.c
diff -u src/lib/libc/gen/waitid.c:1.1 src/lib/libc/gen/waitid.c:1.2
--- src/lib/libc/gen/waitid.c:1.1	Sat Apr  2 20:19:42 2016
+++ src/lib/libc/gen/waitid.c	Sat Apr  2 21:49:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: waitid.c,v 1.1 2016/04/03 00:19:42 christos Exp $	*/
+/*	$NetBSD: waitid.c,v 1.2 2016/04/03 01:49:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: waitid.c,v 1.1 2016/04/03 00:19:42 christos Exp $");
+__RCSID("$NetBSD: waitid.c,v 1.2 2016/04/03 01:49:51 christos Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -41,10 +41,6 @@ __RCSID("$NetBSD: waitid.c,v 1.1 2016/04
 #include <signal.h>
 
 #ifdef __weak_alias
-__weak_alias(waitpid,_waitpid)
-#endif
-
-#ifdef __weak_alias
 __weak_alias(waitid,_waitid)
 #endif
 
@@ -52,15 +48,15 @@ int
 waitid(idtype_t idtype, id_t id, siginfo_t *info, int flags)
 {
 	int status;
-	pid_t rv;
-
-	rv = wait6(idtype, id, &status, flags, NULL, info);
-
-	if (rv < 0)
-		return rv;
-
-	if (rv == 0 && info != NULL)
-		memset(info, 0, sizeof(*info));
 
-	return 0;
+	switch (wait6(idtype, id, &status, flags, NULL, info)) {
+	case -1:
+		return -1;
+	case 0:
+		if (info != NULL)
+			memset(info, 0, sizeof(*info));
+		/*FALLTHROUGH*/
+	default:
+		return 0;
+	}
 }

Reply via email to