resolve: rename RESOLVCONF_PATH

Since it is no longer a define, switch to using lower-case letters
This commit is contained in:
Denis Kenzior 2019-08-07 11:09:50 -05:00
parent f6bb911d2c
commit 37987757e1
1 changed files with 16 additions and 16 deletions

View File

@ -50,7 +50,7 @@ struct resolve_method {
}; };
static struct resolve_method method; static struct resolve_method method;
static char *RESOLVCONF_PATH; static char *resolvconf_path;
#define SYSTEMD_RESOLVED_SERVICE "org.freedesktop.resolve1" #define SYSTEMD_RESOLVED_SERVICE "org.freedesktop.resolve1"
#define SYSTEMD_RESOLVED_MANAGER_PATH "/org/freedesktop/resolve1" #define SYSTEMD_RESOLVED_MANAGER_PATH "/org/freedesktop/resolve1"
@ -257,10 +257,10 @@ static void resolve_resolvconf_add_dns(uint32_t ifindex, uint8_t type,
if (!*ready) if (!*ready)
return; return;
cmd = l_strdup_printf("%s -a %u", RESOLVCONF_PATH, ifindex); cmd = l_strdup_printf("%s -a %u", resolvconf_path, ifindex);
if (!(resolvconf = popen(cmd, "w"))) { if (!(resolvconf = popen(cmd, "w"))) {
l_error("resolve: Failed to start %s (%s).", RESOLVCONF_PATH, l_error("resolve: Failed to start %s (%s).", resolvconf_path,
strerror(errno)); strerror(errno));
return; return;
} }
@ -274,14 +274,14 @@ static void resolve_resolvconf_add_dns(uint32_t ifindex, uint8_t type,
if (fprintf(resolvconf, "%s", str) < 0) if (fprintf(resolvconf, "%s", str) < 0)
l_error("resolve: Failed to print into %s stdin.", l_error("resolve: Failed to print into %s stdin.",
RESOLVCONF_PATH); resolvconf_path);
error = pclose(resolvconf); error = pclose(resolvconf);
if (error < 0) if (error < 0)
l_error("resolve: Failed to close pipe to %s (%s).", l_error("resolve: Failed to close pipe to %s (%s).",
RESOLVCONF_PATH, strerror(errno)); resolvconf_path, strerror(errno));
else if (error > 0) else if (error > 0)
l_info("resolve: %s exited with status (%d).", RESOLVCONF_PATH, l_info("resolve: %s exited with status (%d).", resolvconf_path,
error); error);
} }
@ -295,10 +295,10 @@ static void resolve_resolvconf_remove(uint32_t ifindex, void *data)
if (!*ready) if (!*ready)
return; return;
cmd = l_strdup_printf("%s -d %u", RESOLVCONF_PATH, ifindex); cmd = l_strdup_printf("%s -d %u", resolvconf_path, ifindex);
if (!(resolvconf = popen(cmd, "r"))) { if (!(resolvconf = popen(cmd, "r"))) {
l_error("resolve: Failed to start %s (%s).", RESOLVCONF_PATH, l_error("resolve: Failed to start %s (%s).", resolvconf_path,
strerror(errno)); strerror(errno));
return; return;
} }
@ -306,9 +306,9 @@ static void resolve_resolvconf_remove(uint32_t ifindex, void *data)
error = pclose(resolvconf); error = pclose(resolvconf);
if (error < 0) if (error < 0)
l_error("resolve: Failed to close pipe to %s (%s).", l_error("resolve: Failed to close pipe to %s (%s).",
RESOLVCONF_PATH, strerror(errno)); resolvconf_path, strerror(errno));
else if (error > 0) else if (error > 0)
l_info("resolve: %s exited with status (%d).", RESOLVCONF_PATH, l_info("resolve: %s exited with status (%d).", resolvconf_path,
error); error);
} }
@ -324,19 +324,19 @@ static void *resolve_resolvconf_init(void)
l_debug("Trying to find resolvconf in $PATH"); l_debug("Trying to find resolvconf in $PATH");
path = getenv("PATH"); path = getenv("PATH");
if (path) if (path)
RESOLVCONF_PATH = l_path_find("resolvconf", path, X_OK); resolvconf_path = l_path_find("resolvconf", path, X_OK);
if (!RESOLVCONF_PATH) { if (!resolvconf_path) {
l_debug("Trying to find resolvconf in default paths"); l_debug("Trying to find resolvconf in default paths");
RESOLVCONF_PATH = l_path_find("resolvconf", default_path, X_OK); resolvconf_path = l_path_find("resolvconf", default_path, X_OK);
} }
if (!RESOLVCONF_PATH) { if (!resolvconf_path) {
l_error("No usable resolvconf found on system"); l_error("No usable resolvconf found on system");
return ready; return ready;
} }
l_debug("resolvconf found as: %s", RESOLVCONF_PATH); l_debug("resolvconf found as: %s", resolvconf_path);
*ready = true; *ready = true;
return ready; return ready;
} }
@ -345,7 +345,7 @@ static void resolve_resolvconf_exit(void *data)
{ {
bool *ready = data; bool *ready = data;
RESOLVCONF_PATH = NULL; resolvconf_path = NULL;
l_free(ready); l_free(ready);
} }