commit - fd352ad5f1b1b5bebf381644b212a7ddfb5be007
commit + fcd96d69b52c17e31c79584592eda14b6da359c3
blob - c03769db2af537aa32431b142fbc3be5c9b4a647
blob + aa4aaa5a130799485cd1aafb66606e7136402052
--- if.c
+++ if.c
cmd = (set ? SIOCSIFPARENT : SIOCDIFPARENT);
ret = ioctl(ifs, cmd, &ifp);
if (ret == -1) {
- if (errno == EBUSY) {
- int flags = get_ifflags(ifname, ifs);
- if (flags & IFF_UP) {
+ if (errno == EBUSY) {
+ int flags = get_ifflags(ifname, ifs);
+ if (flags & IFF_UP) {
/* Toggle interface down and retry. and bring the interface back up*/
- set_ifflags(ifname, ifs, flags & ~IFF_UP);
- ret = ioctl(ifs, cmd, &ifp);
- set_ifflags(ifname, ifs, flags);
- }
- }
- if (ret == -1)
- printf("%% intparent: SIOC%sIFPARENT: %s\n",
- set ? "S" : "D", strerror(errno));
+ set_ifflags(ifname, ifs, flags & ~IFF_UP);
+ ret = ioctl(ifs, cmd, &ifp);
+ set_ifflags(ifname, ifs, flags);
+ }
+ }
+ if (ret == -1)
+ printf("%% intparent: SIOC%sIFPARENT: %s\n",
+ set ? "S" : "D", strerror(errno));
}
return 0;