CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Imported core-cross ports from 2.5
[crossrootfs.git] / net-tools / net-tools-1.60-nameif.patch
CommitLineData
6dca1d21
JB
1From Rawhide. Fix for when the wrong device information is shown.
2
3diff -Naur net-tools-1.60.orig/nameif.c net-tools-1.60/nameif.c
4--- net-tools-1.60.orig/nameif.c 2000-10-18 17:26:29.000000000 +0000
5+++ net-tools-1.60/nameif.c 2003-09-12 22:48:57.000000000 +0000
6@@ -117,7 +117,8 @@
7 }
8
9 struct change {
10- struct change *next,**pprev;
11+ struct change *next;
12+ int found;
13 char ifname[IFNAMSIZ+1];
14 unsigned char mac[6];
15 };
16@@ -139,10 +140,7 @@
17 ch->ifname, pos);
18 if (parsemac(p,ch->mac) < 0)
19 complain(_("cannot parse MAC `%s' at %s"), p, pos);
20- if (clist)
21- clist->pprev = &ch->next;
22 ch->next = clist;
23- ch->pprev = &clist;
24 clist = ch;
25 return 0;
26 }
27@@ -200,7 +198,7 @@
28
29 void usage(void)
30 {
31- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}"));
32+ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n"));
33 exit(1);
34 }
35
36@@ -277,21 +275,21 @@
37 ch = lookupmac(mac);
38 if (!ch)
39 continue;
40-
41- *ch->pprev = ch->next;
42+
43+ ch->found = 1;
44 if (strcmp(p, ch->ifname)) {
45 if (setname(p, ch->ifname) < 0)
46 complain(_("cannot change name of %s to %s: %s"),
47 p, ch->ifname, strerror(errno));
48 }
49- free(ch);
50 }
51 fclose(ifh);
52
53 while (clist) {
54 struct change *ch = clist;
55 clist = clist->next;
56- warning(_("interface '%s' not found"), ch->ifname);
57+ if (!ch->found)
58+ warning(_("interface '%s' not found"), ch->ifname);
59 free(ch);
60 }
61