fixup chroot and kill-HUP reread of config file.

git-svn-id: file:///svn/unbound/trunk@1061 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2008-04-21 11:34:25 +00:00
parent c49eefba59
commit 9739014da1
2 changed files with 8 additions and 2 deletions

View file

@ -284,7 +284,8 @@ detach(struct config_file* cfg)
/** daemonize, drop user priviliges and chroot if needed */
static void
do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode)
do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode,
char** cfgfile)
{
uid_t uid;
gid_t gid;
@ -314,6 +315,9 @@ do_chroot(struct daemon* daemon, struct config_file* cfg, int debug_mode)
fatal_exit("unable to chroot to %s: %s",
cfg->chrootdir, strerror(errno));
verbose(VERB_QUERY, "chroot to %s", cfg->chrootdir);
if(strncmp(*cfgfile, cfg->chrootdir,
strlen(cfg->chrootdir)) == 0)
(*cfgfile) += strlen(cfg->chrootdir);
}
if(cfg->username && cfg->username[0]) {
if(setgid(gid) != 0)
@ -382,7 +386,7 @@ run_daemon(char* cfgfile, int cmdline_verbose, int debug_mode)
if(!daemon_open_shared_ports(daemon))
fatal_exit("could not open ports");
if(!done_chroot) {
do_chroot(daemon, cfg, debug_mode);
do_chroot(daemon, cfg, debug_mode, &cfgfile);
done_chroot = 1;
} else log_init(cfg->logfile, cfg->use_syslog, cfg->chrootdir);
/* work */

View file

@ -1,5 +1,7 @@
21 April 2008: Wouter
- FEATURES document.
- fixup reread of config file if it was given as a full path
and chroot was used.
16 April 2008: Wouter
- requirements doc, updated clean query returns.