48 lines
1.0 KiB
Diff
48 lines
1.0 KiB
Diff
--- net-tools-1.60/nameif.c
|
|
+++ net-tools-1.60/nameif.c
|
|
@@ -118,7 +118,8 @@
|
|
}
|
|
|
|
struct change {
|
|
- struct change *next,**pprev;
|
|
+ struct change *next;
|
|
+ int found;
|
|
char ifname_old[IFNAMSIZ+1];
|
|
char ifname_new[IFNAMSIZ+1];
|
|
unsigned char mac[6];
|
|
@@ -156,10 +157,7 @@
|
|
if (parsemac(p,ch->mac) < 0)
|
|
complain(_("cannot parse MAC `%s' at %s"), p, pos);
|
|
}
|
|
- if (clist)
|
|
- clist->pprev = &ch->next;
|
|
ch->next = clist;
|
|
- ch->pprev = &clist;
|
|
clist = ch;
|
|
return 0;
|
|
}
|
|
@@ -303,20 +301,20 @@
|
|
if (!ch)
|
|
continue;
|
|
|
|
- *ch->pprev = ch->next;
|
|
+ ch->found = 1;
|
|
if (strcmp(p, ch->ifname_new)) {
|
|
if (setname(p, ch->ifname_new) < 0)
|
|
complain(_("cannot change name of %s to %s: %s"),
|
|
p, ch->ifname_new, strerror(errno));
|
|
}
|
|
- free(ch);
|
|
}
|
|
fclose(ifh);
|
|
|
|
while (clist) {
|
|
struct change *ch = clist;
|
|
clist = clist->next;
|
|
- complain(_("interface '%s' not found"), ch->ifname_new);
|
|
+ if (!ch->found)
|
|
+ complain(_("interface '%s' not found"), ch->ifname_new);
|
|
free(ch);
|
|
}
|
|
|