summaryrefslogtreecommitdiffstats
path: root/src/popen.c
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2017-09-17 22:17:33 +0000
committerLennart Weller <lhw@ring0.de>2017-09-17 22:17:33 +0000
commit6aaf5ba7ed0980c14bdc554fc8839a2126455ed5 (patch)
tree6161925716661486e7f47c479668a9487b039d83 /src/popen.c
parentNew upstream version 1.7.0+dfsg (diff)
downloadnetdata-6aaf5ba7ed0980c14bdc554fc8839a2126455ed5.tar.xz
netdata-6aaf5ba7ed0980c14bdc554fc8839a2126455ed5.zip
New upstream version 1.8.0+dfsgupstream/1.8.0+dfsg
Diffstat (limited to 'src/popen.c')
-rw-r--r--src/popen.c34
1 files changed, 2 insertions, 32 deletions
diff --git a/src/popen.c b/src/popen.c
index 8448b7311..27be61774 100644
--- a/src/popen.c
+++ b/src/popen.c
@@ -105,38 +105,8 @@ FILE *mypopen(const char *command, pid_t *pidptr)
#endif
// reset all signals
- {
- sigset_t sigset;
- sigfillset(&sigset);
-
- if(pthread_sigmask(SIG_UNBLOCK, &sigset, NULL) == -1)
- error("pre-execution of command '%s' on pid %d: could not unblock signals for threads.", command, getpid());
-
- // We only need to reset ignored signals.
- // Signals with signal handlers are reset by default.
- struct sigaction sa;
- sigemptyset(&sa.sa_mask);
- sa.sa_handler = SIG_DFL;
- sa.sa_flags = 0;
-
- if(sigaction(SIGINT, &sa, NULL) == -1)
- error("pre-execution of command '%s' on pid %d: failed to set default signal handler for SIGINT.", command, getpid());
-
- if(sigaction(SIGTERM, &sa, NULL) == -1)
- error("pre-execution of command '%s' on pid %d: failed to set default signal handler for SIGTERM.", command, getpid());
-
- if(sigaction(SIGPIPE, &sa, NULL) == -1)
- error("pre-execution of command '%s' on pid %d: failed to set default signal handler for SIGPIPE.", command, getpid());
-
- if(sigaction(SIGHUP, &sa, NULL) == -1)
- error("pre-execution of command '%s' on pid %d: failed to set default signal handler for SIGHUP.", command, getpid());
-
- if(sigaction(SIGUSR1, &sa, NULL) == -1)
- error("pre-execution of command '%s' on pid %d: failed to set default signal handler for SIGUSR1.", command, getpid());
-
- if(sigaction(SIGUSR2, &sa, NULL) == -1)
- error("pre-execution of command '%s' on pid %d: failed to set default signal handler for SIGUSR2.", command, getpid());
- }
+ signals_unblock();
+ signals_reset();
debug(D_CHILDS, "executing command: '%s' on pid %d.", command, getpid());
execl("/bin/sh", "sh", "-c", command, NULL);