Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen simplify
details: https://anonhg.NetBSD.org/src/rev/a8547533f311
branches: trunk
changeset: 344516:a8547533f311
user: christos <christos%NetBSD.org@localhost>
date: Sun Apr 03 01:49:51 2016 +0000
description:
simplify
diffstat:
lib/libc/gen/waitid.c | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
diffs (55 lines):
diff -r 1d2da70268ed -r a8547533f311 lib/libc/gen/waitid.c
--- a/lib/libc/gen/waitid.c Sun Apr 03 01:22:39 2016 +0000
+++ b/lib/libc/gen/waitid.c Sun Apr 03 01:49:51 2016 +0000
@@ -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 @@
#include <signal.h>
#ifdef __weak_alias
-__weak_alias(waitpid,_waitpid)
-#endif
-
-#ifdef __weak_alias
__weak_alias(waitid,_waitid)
#endif
@@ -52,15 +48,15 @@
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;
+ }
}
Home |
Main Index |
Thread Index |
Old Index