From b4e35c442e26e85c4ba9b7c73c833923291b2aed Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 14 Sep 2020 17:18:45 -0600 Subject: [PATCH] multicall: load config file data as early as possible --- Makefile | 3 +++ cmd/multicall.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Makefile b/Makefile index a6fa3ff..4c57959 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ PACKAGE_BUGREPORT := https://github.com/ifupdown-ng/ifupdown-ng/issues/new INTERFACES_FILE := /etc/network/interfaces STATE_FILE := /run/ifstate +CONFIG_FILE := /etc/network/ifupdown-ng.conf EXECUTOR_PATH := /usr/libexec/ifupdown-ng CFLAGS ?= -ggdb3 -Os @@ -18,6 +19,7 @@ CFLAGS += ${LIBBSD_CFLAGS} CPPFLAGS = -I. CPPFLAGS += -DINTERFACES_FILE=\"${INTERFACES_FILE}\" CPPFLAGS += -DSTATE_FILE=\"${STATE_FILE}\" +CPPFLAGS += -DCONFIG_FILE=\"${CONFIG_FILE}\" CPPFLAGS += -DPACKAGE_NAME=\"${PACKAGE_NAME}\" CPPFLAGS += -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\" CPPFLAGS += -DPACKAGE_BUGREPORT=\"${PACKAGE_BUGREPORT}\" @@ -127,6 +129,7 @@ install: all for i in ${EXECUTOR_SCRIPTS_STUB}; do \ install -D -m755 executor-scripts/stub/$$i ${DESTDIR}${EXECUTOR_PATH}/$$i; \ done + install -D -m644 dist/ifupdown-ng.conf.example ${DESTDIR}${CONFIG_FILE}.example .scd.1 .scd.2 .scd.3 .scd.4 .scd.5 .scd.6 .scd.7 .scd.8: ${SCDOC} < $< > $@ diff --git a/cmd/multicall.c b/cmd/multicall.c index 0c041ad..705000f 100644 --- a/cmd/multicall.c +++ b/cmd/multicall.c @@ -72,6 +72,8 @@ main(int argc, char *argv[]) argv0 = basename(argv[0]); const struct if_applet **app; + lif_config_load(CONFIG_FILE); + app = bsearch(argv0, applet_table, ARRAY_SIZE(applet_table), sizeof(*applet_table), applet_cmp);