From 2606bc73adaf8aea8b7340be6f4be855a91c2a92 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 14 Sep 2018 17:58:44 +0200 Subject: [PATCH] build: Add DAEMON_ prefix to CONFIGDIR and STORAGEDIR --- configure.ac | 8 ++++---- src/knownnetworks.c | 9 +++++---- src/main.c | 4 ++-- src/storage.c | 4 ++-- tools/test-runner.c | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index de5ffa7a..4f9a090e 100644 --- a/configure.ac +++ b/configure.ac @@ -63,14 +63,14 @@ if (test "${prefix}" = "NONE"); then fi if (test "$localstatedir" = '${prefix}/var'); then - storagedir="${prefix}/var/lib/iwd" + daemon_storagedir="${prefix}/var/lib/iwd" else - storagedir="${localstatedir}/lib/iwd" + daemon_storagedir="${localstatedir}/lib/iwd" fi -AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}", +AC_DEFINE_UNQUOTED(DAEMON_STORAGEDIR, "${daemon_storagedir}", [Directory for the storage files]) -AC_DEFINE_UNQUOTED(CONFIGDIR, "/etc/iwd", [Configuration directory]) +AC_DEFINE_UNQUOTED(DAEMON_CONFIGDIR, "/etc/iwd", [Configuration directory]) AC_CHECK_HEADERS(linux/types.h linux/if_alg.h) diff --git a/src/knownnetworks.c b/src/knownnetworks.c index a5ad3f11..698306a6 100644 --- a/src/knownnetworks.c +++ b/src/knownnetworks.c @@ -369,9 +369,10 @@ bool known_networks_init(void) return false; } - dir = opendir(STORAGEDIR); + dir = opendir(DAEMON_STORAGEDIR); if (!dir) { - l_info("Unable to open %s: %s", STORAGEDIR, strerror(errno)); + l_info("Unable to open %s: %s", DAEMON_STORAGEDIR, + strerror(errno)); l_dbus_unregister_interface(dbus, IWD_KNOWN_NETWORK_INTERFACE); return false; } @@ -404,8 +405,8 @@ bool known_networks_init(void) closedir(dir); - storage_dir_watch = l_fswatch_new(STORAGEDIR, known_networks_watch_cb, - NULL, + storage_dir_watch = l_fswatch_new(DAEMON_STORAGEDIR, + known_networks_watch_cb, NULL, known_networks_watch_destroy); return true; diff --git a/src/main.c b/src/main.c index a43ff45f..d3333fa5 100644 --- a/src/main.c +++ b/src/main.c @@ -437,9 +437,9 @@ int main(int argc, char *argv[]) l_info("Wireless daemon version %s", VERSION); if (!config_dir) - config_dir = CONFIGDIR; + config_dir = DAEMON_CONFIGDIR; - config_path = l_strdup_printf("/%s/%s", config_dir, "main.conf"); + config_path = l_strdup_printf("%s/%s", config_dir, "main.conf"); iwd_config = l_settings_new(); if (!l_settings_load_from_file(iwd_config, config_path)) diff --git a/src/storage.c b/src/storage.c index 4bc056b2..cb2bd5bd 100644 --- a/src/storage.c +++ b/src/storage.c @@ -183,12 +183,12 @@ char *storage_get_network_file_path(enum security type, const char *ssid) hex = l_util_hexstring((const unsigned char *) ssid, strlen(ssid)); - path = l_strdup_printf(STORAGEDIR "/=%s.%s", hex, + path = l_strdup_printf(DAEMON_STORAGEDIR "/=%s.%s", hex, security_to_str(type)); l_free(hex); } else - path = l_strdup_printf(STORAGEDIR "/%s.%s", ssid, + path = l_strdup_printf(DAEMON_STORAGEDIR "/%s.%s", ssid, security_to_str(type)); return path; diff --git a/tools/test-runner.c b/tools/test-runner.c index 3116d519..3255998e 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -1809,7 +1809,7 @@ static void create_network_and_run_tests(const void *key, void *value, HW_CONFIG_GROUP_SETUP, HW_CONFIG_SETUP_IWD_CONF_DIR); if (!iwd_config_dir) - iwd_config_dir = CONFIGDIR; + iwd_config_dir = DAEMON_CONFIGDIR; iwd_pid = start_iwd(iwd_config_dir, wiphy_list, iwd_ext_options);