diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-05-30 16:29:42 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-05-30 16:29:42 +0000 |
commit | f5b42422e4d740dc1841dd6d1060246ab480a379 (patch) | |
tree | f18bb2720ff2378c5f33f9e684db4fa102d0442c /usr.sbin | |
parent | a71df82ca06d118d134d371227851869c298590b (diff) |
Missing waitpid, noticed by Gregory Steuck <greg@y2004.nest.cx>.
Diffstat (limited to 'usr.sbin')
-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); + } } } |