starter: Close open file descriptors when forking daemons.

This commit is contained in:
Tobias Brunner
2012-06-04 18:09:56 +02:00
parent 89c97952bd
commit 402ae88af9
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -192,6 +192,7 @@ int starter_start_charon (starter_config_t *cfg, bool no_fork, bool attach_gdb)
case 0: case 0:
/* child */ /* child */
setsid(); setsid();
closefrom(3);
sigprocmask(SIG_SETMASK, 0, NULL); sigprocmask(SIG_SETMASK, 0, NULL);
/* disable glibc's malloc checker, conflicts with leak detective */ /* disable glibc's malloc checker, conflicts with leak detective */
setenv("MALLOC_CHECK_", "0", 1); setenv("MALLOC_CHECK_", "0", 1);
+1
View File
@@ -276,6 +276,7 @@ starter_start_pluto (starter_config_t *cfg, bool no_fork, bool attach_gdb)
} }
} }
setsid(); setsid();
closefrom(3);
sigprocmask(SIG_SETMASK, 0, NULL); sigprocmask(SIG_SETMASK, 0, NULL);
/* disable glibc's malloc checker, conflicts with leak detective */ /* disable glibc's malloc checker, conflicts with leak detective */
setenv("MALLOC_CHECK_", "0", 1); setenv("MALLOC_CHECK_", "0", 1);