[PATCH] nameif cleanup

Vladimir N. Oleynik dzo at simtreas.ru
Mon Jan 16 09:49:20 UTC 2006


Rob,

> Perhaps it'd be a good idea to do a Busybox-wide search just to see
> how often memset(&foo, 0, ...) is used; if it's used consistently,
> then that's enough reason to create a function in libbb.
> 
> (Incidentally, I'm not sure some of Vladimir's "reverted" changes -
> http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/networking/nameif.c?rev=13342&r1=13333&r2=13342

! 	} else
! 		bb_error_msg(s, ap);
!
   	va_end(ap);

   	exit(EXIT_FAILURE);
   }

--- 60,76 ----
   		openlog(bb_applet_name, 0, LOG_LOCAL0);
   		vsyslog(LOG_ERR, s, ap);
   		closelog();
! 	} else {
! 		bb_verror_msg(s, ap);
! 		putc('\n', stderr);
! 	}


serror() have varg arguments. For exapmle, after your changes
line:
serror("cannot change ifname %s to %s: %m",
           ifr.ifr_name, ch->ifname);
not works.

! 	if (argc - optind == 1)
   		bb_show_usage();

! 	if ((argc - optind) & 1)

nameif applet accept 0,2,4 etc argv only. After your changes
accept odd count arguments.

> - make sense. What's the point in freeing "line"?)

free() its not revert, its my only change: remove small memory leak.


--w
vodz



More information about the busybox mailing list