cvs commit: patches/net-tools net-tools-1.60-nameif-2.patch net-tools-1.60-nameif-1.patch

jim at linuxfromscratch.org jim at linuxfromscratch.org
Sun May 30 12:19:11 PDT 2004


jim         04/05/30 13:19:11

  Added:       net-tools net-tools-1.60-nameif-2.patch
  Removed:     net-tools net-tools-1.60-nameif-1.patch
  Log:
  Fixed: net-tools-1.60-nameif patch
  
  Revision  Changes    Path
  1.1                  patches/net-tools/net-tools-1.60-nameif-2.patch
  
  Index: net-tools-1.60-nameif-2.patch
  ===================================================================
  Submitted By: Jim Gifford (patches at jg555 dot com)
  Date: 2003-09-12
  Initial Package Version: 1.60
  Origin: Rawhide
  Description: Sometimes the wrong device information is shown
  	     It would show the previous interfaces information
  	     This patch corrects this issue
  
  diff -Naur net-tools-1.60.orig/nameif.c net-tools-1.60/nameif.c
  --- net-tools-1.60.orig/nameif.c	2000-10-18 17:26:29.000000000 +0000
  +++ net-tools-1.60/nameif.c	2003-09-12 22:48:57.000000000 +0000
  @@ -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); 
   	}
   
  
  
  



More information about the patches mailing list