mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix directory: fix for unbound-checkconf, it restores cwd.
git-svn-id: file:///svn/unbound/trunk@3783 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
5b63c08c72
commit
2fffe65332
2 changed files with 9 additions and 0 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
13 June 2016: Wouter
|
||||
- Fix #778: unbound 1.5.9: -h segfault (null deref).
|
||||
- Fix directory: fix for unbound-checkconf, it restores cwd.
|
||||
|
||||
10 June 2016: Wouter
|
||||
- And delete service.conf.shipped on uninstall.
|
||||
|
|
|
|||
|
|
@ -481,14 +481,22 @@ check_hints(struct config_file* cfg)
|
|||
static void
|
||||
checkconf(const char* cfgfile, const char* opt, int final)
|
||||
{
|
||||
char oldwd[PATH_MAX];
|
||||
struct config_file* cfg = config_create();
|
||||
if(!cfg)
|
||||
fatal_exit("out of memory");
|
||||
oldwd[0] = 0;
|
||||
if(!getcwd(oldwd, sizeof(oldwd))) {
|
||||
log_err("cannot getcwd: %s", strerror(errno));
|
||||
oldwd[0] = 0;
|
||||
}
|
||||
if(!config_read(cfg, cfgfile, NULL)) {
|
||||
/* config_read prints messages to stderr */
|
||||
config_delete(cfg);
|
||||
exit(1);
|
||||
}
|
||||
if(oldwd[0] && chdir(oldwd) == -1)
|
||||
log_err("cannot chdir(%s): %s", oldwd, strerror(errno));
|
||||
if(opt) {
|
||||
print_option(cfg, opt, final);
|
||||
config_delete(cfg);
|
||||
|
|
|
|||
Loading…
Reference in a new issue