Don't rebind all if found a SSID to rebind.
[dhcpcd-ui] / src / dhcpcd-gtk / main.c
index c28570160e3279a9795f0a968f37685f39cfeeee..5b9d8abf8d1bff1d84b9fd9981273afe5117c4a3 100644 (file)
@@ -389,8 +389,12 @@ dhcpcd_try_open(gpointer data)
        static int last_error;
 
        con = (DHCPCD_CONNECTION *)data;
-       fd = dhcpcd_open(con);
+       fd = dhcpcd_open(con, true);
        if (fd == -1) {
+               if (errno == EACCES || errno == EPERM) {
+                       if ((fd = dhcpcd_open(con, false)) != -1)
+                               goto unprived;
+               }
                if (errno != last_error) {
                        g_critical("dhcpcd_open: %s", strerror(errno));
                        last_error = errno;
@@ -398,6 +402,7 @@ dhcpcd_try_open(gpointer data)
                return TRUE;
        }
 
+unprived:
        if (!dhcpcd_watch(fd, dhcpcd_cb, con)) {
                dhcpcd_close(con);
                return TRUE;
@@ -591,6 +596,7 @@ main(int argc, char *argv[])
                g_critical("libdhcpcd: %s", strerror(errno));
                exit(EXIT_FAILURE);
        }
+       dhcpcd_set_progname(con, "dhcpcd-gtk");
        dhcpcd_set_status_callback(con, dhcpcd_status_cb, NULL);
        dhcpcd_set_if_callback(con, dhcpcd_if_cb, NULL);
        dhcpcd_wpa_set_scan_callback(con, dhcpcd_wpa_scan_cb, NULL);