mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 21:11:04 +01:00
When path to the configuration file is relative, obtain full path,
so we can always find the file, even after daemonizing and changing working directory to /. MFC after: 1 week
This commit is contained in:
parent
715a43edd0
commit
6fea20e297
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226461
@ -1168,6 +1168,22 @@ main(int argc, char *argv[])
|
||||
pjdlog_errno(LOG_WARNING, "Unable to open or create pidfile");
|
||||
}
|
||||
|
||||
/*
|
||||
* When path to the configuration file is relative, obtain full path,
|
||||
* so we can always find the file, even after daemonizing and changing
|
||||
* working directory to /.
|
||||
*/
|
||||
if (cfgpath[0] != '/') {
|
||||
const char *newcfgpath;
|
||||
|
||||
newcfgpath = realpath(cfgpath, NULL);
|
||||
if (newcfgpath == NULL) {
|
||||
pjdlog_exit(EX_CONFIG,
|
||||
"Unable to obtain full path of %s", cfgpath);
|
||||
}
|
||||
cfgpath = newcfgpath;
|
||||
}
|
||||
|
||||
cfg = yy_config_parse(cfgpath, true);
|
||||
PJDLOG_ASSERT(cfg != NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user