summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2007-01-23 20:01:30 +0100
committerKay Sievers <kay.sievers@vrfy.org>2007-01-23 20:01:30 +0100
commitca714ef70e549aad486a62f4d6ef849572e3a7f1 (patch)
treeaeed8cc505682da2ee01ee27dcc1180ad499e262
parente0c0807ab32fde7f55776e0a300016bad922e636 (diff)
fix retry-loop in netif-rename code
-rw-r--r--udev_device.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/udev_device.c b/udev_device.c
index bc0b33077e..1eebd61cc5 100644
--- a/udev_device.c
+++ b/udev_device.c
@@ -122,16 +122,17 @@ static int rename_netif(struct udevice *udev)
strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ);
loop = 30 * 20;
while (loop--) {
- retval = ioctl(sk, SIOCSIFNAME, &ifr);
- if (retval != 0) {
- if (errno != EEXIST) {
- err("error changing net interface name %s to %s: %s",
- ifr.ifr_name, ifr.ifr_newname, strerror(errno));
- break;
- }
- dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop);
- usleep(1000 * 1000 / 20);
+ retval = ioctl(sk, SIOCSIFNAME, &ifr);
+ if (retval == 0)
+ break;
+
+ if (errno != EEXIST) {
+ err("error changing net interface name %s to %s: %s",
+ ifr.ifr_name, ifr.ifr_newname, strerror(errno));
+ break;
}
+ dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop);
+ usleep(1000 * 1000 / 20);
}
}