Module Name: src
Committed By: ozaki-r
Date: Tue May 19 04:14:04 UTC 2015
Modified Files:
src/tests/net/mcast: t_mcast.c
Log Message:
Handle child's exit status precisely
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/net/mcast/t_mcast.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/net/mcast/t_mcast.c
diff -u src/tests/net/mcast/t_mcast.c:1.14 src/tests/net/mcast/t_mcast.c:1.15
--- src/tests/net/mcast/t_mcast.c:1.14 Tue May 19 03:19:27 2015
+++ src/tests/net/mcast/t_mcast.c Tue May 19 04:14:04 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mcast.c,v 1.14 2015/05/19 03:19:27 ozaki-r Exp $ */
+/* $NetBSD: t_mcast.c,v 1.15 2015/05/19 04:14:04 ozaki-r Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: t_mcast.c,v 1.14 2015/05/19 03:19:27 ozaki-r Exp $");
+__RCSID("$NetBSD: t_mcast.c,v 1.15 2015/05/19 04:14:04 ozaki-r Exp $");
#else
extern const char *__progname;
#define getprogname() __progname
@@ -316,9 +316,25 @@ run(const char *host, const char *port,
strerror(errno));
goto again;
default:
- if (status != 0)
- ERRX(EXIT_FAILURE, "pid exited with %d",
+ if (WIFSIGNALED(status)) {
+ if (WTERMSIG(status) == SIGTERM)
+ ERRX(EXIT_FAILURE,
+ "receiver got terminated due to " \
+ "deadline (%d usec)", 100);
+ else
+ ERRX(EXIT_FAILURE,
+ "receiver got signaled (%s)",
+ strsignal(WTERMSIG(status)));
+ } else if (WIFEXITED(status)) {
+ if (WEXITSTATUS(status) != 0)
+ ERRX(EXIT_FAILURE,
+ "receiver exited with status %d",
+ WEXITSTATUS(status));
+ } else {
+ ERRX(EXIT_FAILURE,
+ "receiver exited with unexpected status %d",
status);
+ }
break;
}
return;