diff options
author | grange <grange@openbsd.org> | 2004-05-30 16:29:41 +0000 |
---|---|---|
committer | grange <grange@openbsd.org> | 2004-05-30 16:29:41 +0000 |
commit | ee5b800103d484f57f53103cd16e2c9cb4f76efd (patch) | |
tree | f8b64f6b2243a4c60e919e597a02ce86d042e45e /usr.sbin/hotplugd | |
parent | sync (diff) | |
download | wireguard-openbsd-ee5b800103d484f57f53103cd16e2c9cb4f76efd.tar.xz wireguard-openbsd-ee5b800103d484f57f53103cd16e2c9cb4f76efd.zip |
Missing waitpid, noticed by Gregory Steuck <greg@y2004.nest.cx>.
Diffstat (limited to 'usr.sbin/hotplugd')
-rw-r--r-- | usr.sbin/hotplugd/hotplugd.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.sbin/hotplugd/hotplugd.c b/usr.sbin/hotplugd/hotplugd.c index 2f18d7b9159..108ff133a30 100644 --- a/usr.sbin/hotplugd/hotplugd.c +++ b/usr.sbin/hotplugd/hotplugd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hotplugd.c,v 1.1 2004/05/30 08:28:28 grange Exp $ */ +/* $OpenBSD: hotplugd.c,v 1.2 2004/05/30 16:29:41 grange Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> * @@ -127,6 +127,7 @@ exec_script(const char *file, int class, char *name) { char strclass[8]; pid_t pid; + int status; snprintf(strclass, sizeof(strclass), "%d", class); @@ -144,6 +145,19 @@ exec_script(const char *file, int class, char *name) syslog(LOG_ERR, "execl: %m"); _exit(1); /* NOTREACHED */ + } else { + /* parent process */ + if (waitpid(pid, &status, 0) == -1) { + syslog(LOG_ERR, "waitpid: %m"); + return; + } + if (WIFEXITED(status)) { + if (WEXITSTATUS(status) != 0) + syslog(LOG_NOTICE, "%s: exit status %d", file, + WEXITSTATUS(status)); + } else { + syslog(LOG_NOTICE, "%s: terminated abnormally", file); + } } } |