Source-Changes-HG archive

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

[src/trunk]: src/tests/net/mcast Handle child's exit status precisely



details:   https://anonhg.NetBSD.org/src/rev/a2d8d49a4a87
branches:  trunk
changeset: 808482:a2d8d49a4a87
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue May 19 04:14:04 2015 +0000

description:
Handle child's exit status precisely

diffstat:

 tests/net/mcast/t_mcast.c |  24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 057083ba585a -r a2d8d49a4a87 tests/net/mcast/t_mcast.c
--- a/tests/net/mcast/t_mcast.c Tue May 19 03:19:27 2015 +0000
+++ b/tests/net/mcast/t_mcast.c Tue May 19 04:14:04 2015 +0000
@@ -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 @@
                                    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;



Home | Main Index | Thread Index | Old Index