summaryrefslogtreecommitdiffstats
path: root/support/include/ha-callout.h
diff options
context:
space:
mode:
authorneilbrown <neilbrown>2004-12-10 01:15:45 +0000
committerneilbrown <neilbrown>2004-12-10 01:15:45 +0000
commitb3e11098b1eaf65caae2fa0787e9839ce7d5e818 (patch)
tree6cf85875e41321d77b52d3ddb33e236a8ba874e5 /support/include/ha-callout.h
parent604bc72d3a4894d6569f8cc58d935cc62217aee6 (diff)
downloadnfs-utils-b3e11098b1eaf65caae2fa0787e9839ce7d5e818.tar.gz
nfs-utils-b3e11098b1eaf65caae2fa0787e9839ce7d5e818.tar.xz
nfs-utils-b3e11098b1eaf65caae2fa0787e9839ce7d5e818.zip
ha-callout ands sigchld
Diffstat (limited to 'support/include/ha-callout.h')
-rw-r--r--support/include/ha-callout.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/support/include/ha-callout.h b/support/include/ha-callout.h
index 8acf0de..64a430d 100644
--- a/support/include/ha-callout.h
+++ b/support/include/ha-callout.h
@@ -14,6 +14,7 @@
#define HA_CALLOUT_H
#include <sys/wait.h>
+#include <signal.h>
extern char *ha_callout_prog;
@@ -23,12 +24,22 @@ ha_callout(char *event, char *arg1, char *arg2, int arg3)
char buf[16]; /* should be plenty */
pid_t pid;
int ret = -1;
+ struct sigaction oldact, newact;
if (!ha_callout_prog) /* HA callout is not enabled */
return;
sprintf(buf, "%d", arg3);
+ /* many daemons ignore SIGCHLD as tcpwrappers will
+ * fork a child to do logging. We need to wait
+ * for a child here, so we need to un-ignore
+ * SIGCHLD temporarily
+ */
+ newact.sa_handler = SIG_DFL;
+ newacc.sa_flags = 0;
+ sigemptyset(&newact.sa_mask);
+ sigaction(SIGCHLD, &newact, &oldact);
pid = fork();
switch (pid) {
case 0: execl(ha_callout_prog, ha_callout_prog,
@@ -41,7 +52,7 @@ ha_callout(char *event, char *arg1, char *arg2, int arg3)
break;
default: pid = waitpid(pid, &ret, 0);
}
-
+ sigaction(SIGCHLD, &oldact, &newact);
#ifdef dprintf
dprintf(N_DEBUG, "ha callout returned %d\n", WEXITSTATUS(ret));
#else