read config file before change working dir

This commit is contained in:
arowser 2018-11-20 11:46:08 +08:00 committed by Rusty Russell
parent 795bc1b3a7
commit 56a3b3f3df

View file

@ -837,6 +837,11 @@ void handle_early_opts(struct lightningd *ld, int argc, char *argv[])
void handle_opts(struct lightningd *ld, int argc, char *argv[])
{
/* Now look for config file, but only handle non-early
* options, early ones have been parsed in
* handle_early_opts */
opt_parse_from_config(ld, false);
/* Move to config dir, to save ourselves the hassle of path manip. */
if (chdir(ld->config_dir) != 0) {
log_unusual(ld->log, "Creating configuration directory %s",
@ -849,11 +854,6 @@ void handle_opts(struct lightningd *ld, int argc, char *argv[])
ld->config_dir, strerror(errno));
}
/* Now look for config file, but only handle non-early
* options, early ones have been parsed in
* handle_early_opts */
opt_parse_from_config(ld, false);
opt_parse(&argc, argv, opt_log_stderr_exit);
if (argc != 1)
errx(1, "no arguments accepted");