summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-09-28 13:28:09 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-09-28 13:28:09 +0000
commit76b8a8707dbb1887e94f812c4a9ca8b65d3353fd (patch)
treebe37fc6f057003ca0aa7842cc6a60858e519b6ba
parent1ed2cb39e498622f727be5dc129cd5105d34200f (diff)
Fix interface down.
-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;
}