|
|
|
@ -4295,7 +4295,7 @@ out:
@@ -4295,7 +4295,7 @@ out:
|
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if !defined(WIN32) |
|
|
|
|
#if defined(unix) |
|
|
|
|
static void fork_monitor() |
|
|
|
|
{ |
|
|
|
|
// Make a pipe: [readFD, writeFD]
|
|
|
|
@ -4320,8 +4320,9 @@ static void fork_monitor()
@@ -4320,8 +4320,9 @@ static void fork_monitor()
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Don't allow a dying monitor to kill the main process
|
|
|
|
|
sighandler_t sr = signal(SIGPIPE, SIG_IGN); |
|
|
|
|
if (SIG_ERR==sr) { |
|
|
|
|
sighandler_t sr0 = signal(SIGPIPE, SIG_IGN); |
|
|
|
|
sighandler_t sr1 = signal(SIGPIPE, SIG_IGN); |
|
|
|
|
if (SIG_ERR==sr0 || SIG_ERR==sr1) { |
|
|
|
|
perror("signal - failed to edit signal mask for --monitor"); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
@ -4333,7 +4334,7 @@ static void fork_monitor()
@@ -4333,7 +4334,7 @@ static void fork_monitor()
|
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// In child, launch command
|
|
|
|
|
// Child: launch monitor command
|
|
|
|
|
if (0==r) { |
|
|
|
|
// Make stdin read end of pipe
|
|
|
|
|
r = dup2(pfd[0], 0); |
|
|
|
@ -4353,14 +4354,14 @@ static void fork_monitor()
@@ -4353,14 +4354,14 @@ static void fork_monitor()
|
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// In parent, clean up unused fds
|
|
|
|
|
// Parent: clean up unused fds and bail
|
|
|
|
|
r = close(pfd[0]); |
|
|
|
|
if (r<0) { |
|
|
|
|
perror("close - failed to close read end of pipe for --monitor"); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif // !WIN32
|
|
|
|
|
#endif // defined(unix)
|
|
|
|
|
|
|
|
|
|
int main (int argc, char *argv[]) |
|
|
|
|
{ |
|
|
|
|