mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-10 14:23:36 -05:00
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:
parent
c49eefba59
commit
9739014da1
2 changed files with 8 additions and 2 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue