dnsmasq: backport latest patches
[openwrt/openwrt.git] / package / network / services / dnsmasq / patches / 0051-Allow-more-then-one-conf-file-on-the-command-line.patch
1 From 5c464ef62e02dea96f830425cf43da7f6a272b4c Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Fri, 29 Mar 2019 23:11:05 +0000
4 Subject: [PATCH 51/57] Allow more then one --conf-file on the command line.
5
6 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
7 ---
8 man/dnsmasq.8 | 5 +++--
9 src/option.c | 11 ++++++++---
10 2 files changed, 11 insertions(+), 5 deletions(-)
11
12 --- a/man/dnsmasq.8
13 +++ b/man/dnsmasq.8
14 @@ -1942,8 +1942,9 @@ cannot be lower than 1025 unless dnsmasq
15 of concurrent TFTP connections is limited by the size of the port range.
16 .TP
17 .B \-C, --conf-file=<file>
18 -Specify a different configuration file. The \fB--conf-file\fP option is also allowed in
19 -configuration files, to include multiple configuration files. A
20 +Specify a configuration file. The presence of this option stops dnsmasq from reading the default configuration
21 +file (normally /etc/dnsmasq.conf). Multiple files may be specified by repeating the option
22 +either on the command line or in configuration files. A
23 filename of "-" causes dnsmasq to read configuration from stdin.
24 .TP
25 .B \-7, --conf-dir=<directory>[,<file-extension>......],
26 --- a/src/option.c
27 +++ b/src/option.c
28 @@ -5012,9 +5012,14 @@ void read_opts(int argc, char **argv, ch
29 }
30 else if (option == 'C')
31 {
32 - if (conffile)
33 - free(conffile);
34 - conffile = opt_string_alloc(arg);
35 + if (!conffile)
36 + conffile = opt_string_alloc(arg);
37 + else
38 + {
39 + char *extra = opt_string_alloc(arg);
40 + one_file(extra, 0);
41 + free(extra);
42 + }
43 }
44 else
45 {