Fix: save: leak of configuration file fd
[lttng-tools.git] / src / common / runas.c
index 46c7b9feac0cc8ac5ececb2c205127ce21b6954b..33cb5016348563911d9e8550818a91d286315526 100644 (file)
@@ -29,7 +29,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sched.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <assert.h>
 #include <sys/prctl.h>
 
@@ -528,23 +528,14 @@ int run_as_rmdir_recursive(const char *path, uid_t uid, gid_t gid)
 }
 
 static
-int reset_sighandler(void)
+void reset_sighandler(void)
 {
-       int sig, ret = 0;
+       int sig;
 
-       for (sig = SIGHUP; sig <= SIGUNUSED; sig++) {
-               /* Skip unblockable signals. */
-               if (sig == SIGKILL || sig == SIGSTOP) {
-                       continue;
-               }
-               if (signal(sig, SIG_DFL) == SIG_ERR) {
-                       PERROR("reset signal %d", sig);
-                       ret = -1;
-                       goto end;
-               }
+       DBG("Resetting run_as worker signal handlers to default");
+       for (sig = 1; sig <= 31; sig++) {
+               (void) signal(sig, SIG_DFL);
        }
-end:
-       return ret;
 }
 
 static
This page took 0.025939 seconds and 4 git commands to generate.