]>
Commit | Line | Data |
---|---|---|
236898d6 MT |
1 | --- net-tools-1.60/nameif.c.nameif 2000-10-18 19:26:29.000000000 +0200 |
2 | +++ net-tools-1.60/nameif.c 2003-03-19 11:02:01.000000000 +0100 | |
3 | @@ -3,7 +3,7 @@ | |
4 | * Writen 2000 by Andi Kleen. | |
5 | * Subject to the Gnu Public License, version 2. | |
6 | * TODO: make it support token ring etc. | |
7 | - * $Id: nameif.c,v 1.1 2000/10/18 17:26:29 ak Exp $ | |
8 | + * $Id: nameif.c,v 1.3 2003/03/06 23:26:52 ecki Exp $ | |
9 | */ | |
10 | #ifndef _GNU_SOURCE | |
11 | #define _GNU_SOURCE | |
12 | @@ -117,7 +117,8 @@ | |
13 | } | |
14 | ||
15 | struct change { | |
16 | - struct change *next,**pprev; | |
17 | + struct change *next; | |
18 | + int found; | |
19 | char ifname[IFNAMSIZ+1]; | |
20 | unsigned char mac[6]; | |
21 | }; | |
22 | @@ -139,10 +140,7 @@ | |
23 | ch->ifname, pos); | |
24 | if (parsemac(p,ch->mac) < 0) | |
25 | complain(_("cannot parse MAC `%s' at %s"), p, pos); | |
26 | - if (clist) | |
27 | - clist->pprev = &ch->next; | |
28 | ch->next = clist; | |
29 | - ch->pprev = &clist; | |
30 | clist = ch; | |
31 | return 0; | |
32 | } | |
33 | @@ -200,7 +198,7 @@ | |
34 | ||
35 | void usage(void) | |
36 | { | |
37 | - fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}")); | |
38 | + fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n")); | |
39 | exit(1); | |
40 | } | |
41 | ||
42 | @@ -277,21 +275,21 @@ | |
43 | ch = lookupmac(mac); | |
44 | if (!ch) | |
45 | continue; | |
46 | - | |
47 | - *ch->pprev = ch->next; | |
48 | + | |
49 | + ch->found = 1; | |
50 | if (strcmp(p, ch->ifname)) { | |
51 | if (setname(p, ch->ifname) < 0) | |
52 | complain(_("cannot change name of %s to %s: %s"), | |
53 | p, ch->ifname, strerror(errno)); | |
54 | } | |
55 | - free(ch); | |
56 | } | |
57 | fclose(ifh); | |
58 | ||
59 | while (clist) { | |
60 | struct change *ch = clist; | |
61 | clist = clist->next; | |
62 | - warning(_("interface '%s' not found"), ch->ifname); | |
63 | + if (!ch->found) | |
64 | + warning(_("interface '%s' not found"), ch->ifname); | |
65 | free(ch); | |
66 | } | |
67 |