git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

This commit is contained in:
ipfire
2006-02-15 21:15:54 +00:00
parent 6d63f4c4b3
commit cd1a292722
1206 changed files with 185026 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
diff -u -r1.1 -r1.3
--- nameif.c 18 Oct 2000 17:26:29 -0000 1.1
+++ nameif.c 6 Mar 2003 23:26:52 -0000 1.3
@@ -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);
}