diff options
Diffstat (limited to 'src/charon/charon.c')
-rw-r--r-- | src/charon/charon.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/charon/charon.c b/src/charon/charon.c index 089ac4570..8afac3fff 100644 --- a/src/charon/charon.c +++ b/src/charon/charon.c @@ -26,6 +26,8 @@ #include <sys/utsname.h> #include <unistd.h> #include <getopt.h> +#include <fcntl.h> +#include <errno.h> #include <hydra.h> #include <daemon.h> @@ -122,12 +124,15 @@ static void run() { DBG1(DBG_DMN, "signal of type SIGHUP received. Reloading " "configuration"); - if (lib->settings->load_files(lib->settings, NULL, FALSE)) +#ifdef STRONGSWAN_CONF + if (lib->settings->load_files(lib->settings, STRONGSWAN_CONF, + FALSE)) { charon->load_loggers(charon, levels, !use_syslog); lib->plugins->reload(lib->plugins, NULL); } else +#endif { DBG1(DBG_DMN, "reloading config failed, keeping old"); } @@ -229,6 +234,14 @@ static bool check_pidfile() pidfile = fopen(PID_FILE, "w"); if (pidfile) { + int fd; + + fd = fileno(pidfile); + if (fd == -1 || fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) + { + DBG1(DBG_LIB, "setting FD_CLOEXEC for '"PID_FILE"' failed: %s", + strerror(errno)); + } ignore_result(fchown(fileno(pidfile), lib->caps->get_uid(lib->caps), lib->caps->get_gid(lib->caps))); |