From f5fc7e7700aec3e0506467f618d95794b46e0ab9 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 24 Nov 2014 13:22:10 +0100 Subject: [PATCH] Added code from KO to protect my_sell against alarm() signal --- src/elogd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index fe88186b..c72a4777 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -899,15 +899,17 @@ int my_shell(char *cmd, char *result, int size) #ifdef OS_UNIX pid_t child_pid; - int fh, status, i; + int fh, status, i, wait_status; char str[1024]; if ((child_pid = fork()) < 0) return 0; else if (child_pid > 0) { /* parent process waits for child */ - waitpid(child_pid, &status, 0); - + do { + wait_status = waitpid(child_pid, &status, 0); + } while (wait_status == -1 && errno == EINTR); + /* read back result */ memset(result, 0, size); fh = open("/tmp/elog-shell", O_RDONLY);