diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-08-09 04:39:52 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-08-09 04:39:52 +0200 |
commit | 6232321cbe36b7ddaa3f6946a8c562a32d25845e (patch) | |
tree | 9d822641fd3b55a7e85d50c8d19ded66d7a8c77b | |
parent | 51818dc258152d9578c78219eb6fe32e5e94c84e (diff) | |
download | connman-6232321cbe36b7ddaa3f6946a8c562a32d25845e.tar.gz connman-6232321cbe36b7ddaa3f6946a8c562a32d25845e.tar.bz2 connman-6232321cbe36b7ddaa3f6946a8c562a32d25845e.zip |
Check if resolvconf is actually installed
-rw-r--r-- | plugins/resolvconf.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/resolvconf.c b/plugins/resolvconf.c index 1d4927b5..b0650603 100644 --- a/plugins/resolvconf.c +++ b/plugins/resolvconf.c @@ -23,12 +23,15 @@ #include <config.h> #endif +#include <unistd.h> #include <stdlib.h> #include <connman/plugin.h> #include <connman/driver.h> #include <connman/log.h> +#define RESOLVCONF "/sbin/resolvconf" + static int resolvconf_probe(struct connman_element *element) { const char *nameserver = NULL; @@ -38,14 +41,18 @@ static int resolvconf_probe(struct connman_element *element) DBG("element %p name %s", element, element->name); + if (access(RESOLVCONF, X_OK) < 0) + return -errno; + connman_element_get_value(element, CONNMAN_PROPERTY_TYPE_IPV4_NAMESERVER, &nameserver); if (nameserver == NULL) return -EINVAL; - cmd = g_strdup_printf("echo \"nameserver %s\" | resolvconf -a %s", - nameserver, element->netdev.name); + cmd = g_strdup_printf("echo \"nameserver %s\" | %s -a %s", + RESOLVCONF, nameserver, + element->netdev.name); DBG("%s", cmd); @@ -78,7 +85,7 @@ static void resolvconf_remove(struct connman_element *element) connman_element_unref(internet); - cmd = g_strdup_printf("resolvconf -d %s", element->netdev.name); + cmd = g_strdup_printf("%s -d %s", RESOLVCONF, element->netdev.name); DBG("%s", cmd); |