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