summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--network/common.c23
1 files 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;
}