From 6232321cbe36b7ddaa3f6946a8c562a32d25845e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 9 Aug 2008 04:39:52 +0200 Subject: Check if resolvconf is actually installed --- plugins/resolvconf.c | 13 ++++++++++--- 1 file 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 #endif +#include #include #include #include #include +#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); -- cgit v1.2.3