Magellan Linux

Annotation of /trunk/net-tools/patches/net-tools-1.60-cleanup-list-handling.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (hide annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years, 1 month ago) by niro
File size: 1322 byte(s)
-import

1 niro 153 diff -u -r1.1 -r1.3
2     --- nameif.c 18 Oct 2000 17:26:29 -0000 1.1
3     +++ nameif.c 6 Mar 2003 23:26:52 -0000 1.3
4     @@ -117,7 +117,8 @@
5     }
6    
7     struct change {
8     - struct change *next,**pprev;
9     + struct change *next;
10     + int found;
11     char ifname[IFNAMSIZ+1];
12     unsigned char mac[6];
13     };
14     @@ -139,10 +140,7 @@
15     ch->ifname, pos);
16     if (parsemac(p,ch->mac) < 0)
17     complain(_("cannot parse MAC `%s' at %s"), p, pos);
18     - if (clist)
19     - clist->pprev = &ch->next;
20     ch->next = clist;
21     - ch->pprev = &clist;
22     clist = ch;
23     return 0;
24     }
25     @@ -200,7 +198,7 @@
26    
27     void usage(void)
28     {
29     - fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}"));
30     + fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n"));
31     exit(1);
32     }
33    
34     @@ -277,21 +275,21 @@
35     ch = lookupmac(mac);
36     if (!ch)
37     continue;
38     -
39     - *ch->pprev = ch->next;
40     +
41     + ch->found = 1;
42     if (strcmp(p, ch->ifname)) {
43     if (setname(p, ch->ifname) < 0)
44     complain(_("cannot change name of %s to %s: %s"),
45     p, ch->ifname, strerror(errno));
46     }
47     - free(ch);
48     }
49     fclose(ifh);
50    
51     while (clist) {
52     struct change *ch = clist;
53     clist = clist->next;
54     - warning(_("interface '%s' not found"), ch->ifname);
55     + if (!ch->found)
56     + warning(_("interface '%s' not found"), ch->ifname);
57     free(ch);
58     }
59    
60    
61