From 76b8a8707dbb1887e94f812c4a9ca8b65d3353fd Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 28 Sep 2007 13:28:09 +0000 Subject: Fix interface down. --- network/common.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/network/common.c b/network/common.c index 96821f84..d7174a18 100644 --- a/network/common.c +++ b/network/common.c @@ -279,6 +279,18 @@ int bnep_if_down(const char *devname) struct ifreq ifr; GSList *l; + for(l = pids; l; l = g_slist_next(l)) { + struct bnep_data *bnep = l->data; + + if (strcmp(devname, bnep->devname) == 0) { + if (kill(bnep->pid, SIGTERM) < 0) + error("kill(%d, SIGTERM): %s (%d)", bnep->pid, + strerror(errno), errno); + pids = g_slist_remove(pids, bnep); + break; + } + } + sd = socket(AF_INET6, SOCK_DGRAM, 0); memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, devname); @@ -292,17 +304,6 @@ int bnep_if_down(const char *devname) return -err; } - for(l = pids; l; l = g_slist_next(l)) { - struct bnep_data *bnep = l->data; - - if (strcmp(devname, bnep->devname) == 0) { - if (kill(bnep->pid, SIGTERM) < 0) - error("kill(%d, SIGTERM): %s (%d)", bnep->pid, - strerror(errno), errno); - break; - } - } - return 0; } -- cgit