summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/unwind/parse.y9
-rw-r--r--sbin/unwind/unwind.c10
-rw-r--r--sbin/unwind/unwind.h4
3 files changed, 11 insertions, 12 deletions
diff --git a/sbin/unwind/parse.y b/sbin/unwind/parse.y
index b64997c334f..77e2749e86b 100644
--- a/sbin/unwind/parse.y
+++ b/sbin/unwind/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.16 2019/11/26 18:09:15 kn Exp $ */
+/* $OpenBSD: parse.y,v 1.17 2019/11/26 19:35:13 kn Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -776,15 +776,16 @@ popfile(void)
}
struct uw_conf *
-parse_config(char *filename, int require_file)
+parse_config(char *filename)
{
struct sym *sym, *next;
conf = config_new_empty();
- file = pushfile(filename, 0);
+ file = pushfile(filename != NULL ? filename : CONF_FILE, 0);
if (file == NULL) {
- if (errno == ENOENT && !require_file)
+ /* no default config file is fine */
+ if (errno == ENOENT && filename == NULL)
return (conf);
log_warn("%s", filename);
free(conf);
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c
index 7ed76600f3b..e514868fc22 100644
--- a/sbin/unwind/unwind.c
+++ b/sbin/unwind/unwind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.c,v 1.38 2019/11/26 18:09:15 kn Exp $ */
+/* $OpenBSD: unwind.c,v 1.39 2019/11/26 19:35:13 kn Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -77,8 +77,7 @@ struct uw_conf *main_conf;
struct imsgev *iev_frontend;
struct imsgev *iev_resolver;
struct imsgev *iev_captiveportal;
-char *conffile = CONF_FILE;
-int require_file;
+char *conffile;
pid_t frontend_pid;
pid_t resolver_pid;
@@ -158,7 +157,6 @@ main(int argc, char *argv[])
break;
case 'f':
conffile = optarg;
- require_file = 1;
break;
case 'n':
cmd_opts |= OPT_NOACTION;
@@ -188,7 +186,7 @@ main(int argc, char *argv[])
else if (captiveportal_flag)
captiveportal(debug, cmd_opts & (OPT_VERBOSE | OPT_VERBOSE2));
- if ((main_conf = parse_config(conffile, require_file)) == NULL)
+ if ((main_conf = parse_config(conffile)) == NULL)
exit(1);
if (cmd_opts & OPT_NOACTION) {
@@ -692,7 +690,7 @@ main_reload(void)
{
struct uw_conf *xconf;
- if ((xconf = parse_config(conffile, require_file)) == NULL)
+ if ((xconf = parse_config(conffile)) == NULL)
return (-1);
if (main_imsg_send_config(xconf) == -1)
diff --git a/sbin/unwind/unwind.h b/sbin/unwind/unwind.h
index 64eb4a997a2..af0a4bbe80a 100644
--- a/sbin/unwind/unwind.h
+++ b/sbin/unwind/unwind.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.h,v 1.35 2019/11/26 18:09:15 kn Exp $ */
+/* $OpenBSD: unwind.h,v 1.36 2019/11/26 19:35:13 kn Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -176,5 +176,5 @@ void config_clear(struct uw_conf *);
void print_config(struct uw_conf *);
/* parse.y */
-struct uw_conf *parse_config(char *, int);
+struct uw_conf *parse_config(char *);
int cmdline_symset(char *);