]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
starter: Close open file descriptors when forking daemons.
authorTobias Brunner <tobias@strongswan.org>
Thu, 31 May 2012 14:44:03 +0000 (16:44 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 4 Jun 2012 16:09:56 +0000 (18:09 +0200)
src/starter/invokecharon.c
src/starter/invokepluto.c

index e88939415017b9b1bff897042562e7e47c91cc57..ead55e9cc65a7ac745d06cbd156f00aaf6c5a047 100644 (file)
@@ -192,6 +192,7 @@ int starter_start_charon (starter_config_t *cfg, bool no_fork, bool attach_gdb)
                case 0:
                        /* child */
                        setsid();
+                       closefrom(3);
                        sigprocmask(SIG_SETMASK, 0, NULL);
                        /* disable glibc's malloc checker, conflicts with leak detective */
                        setenv("MALLOC_CHECK_", "0", 1);
index 70c0692ea296abb22a42670c8bbfd5ff5d4a17f1..2f46c99fbc0df9a81804541dffeb26858fb3c588 100644 (file)
@@ -276,6 +276,7 @@ starter_start_pluto (starter_config_t *cfg, bool no_fork, bool attach_gdb)
                                }
                        }
                        setsid();
+                       closefrom(3);
                        sigprocmask(SIG_SETMASK, 0, NULL);
                        /* disable glibc's malloc checker, conflicts with leak detective */
                        setenv("MALLOC_CHECK_", "0", 1);