diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-01-15 09:29:41 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-01-15 09:29:41 +0000 |
commit | 8c9daa12dcb4c1aa8f0f475896c9cfbcfb38370d (patch) | |
tree | 2e2583ed13cc1234397ad941ee6abc8bf4bf916f /networking/nameif.c | |
parent | 855f1e13202845a3b7f354b5452db4627c37f33c (diff) | |
download | busybox-w32-8c9daa12dcb4c1aa8f0f475896c9cfbcfb38370d.tar.gz busybox-w32-8c9daa12dcb4c1aa8f0f475896c9cfbcfb38370d.tar.bz2 busybox-w32-8c9daa12dcb4c1aa8f0f475896c9cfbcfb38370d.zip |
restore erronyous 'cleanups' by Rob Sullivan and landley
Diffstat (limited to 'networking/nameif.c')
-rw-r--r-- | networking/nameif.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/networking/nameif.c b/networking/nameif.c index 5fee465cc..a2c8b4915 100644 --- a/networking/nameif.c +++ b/networking/nameif.c | |||
@@ -60,16 +60,17 @@ static void serror(const char *s, ...) | |||
60 | openlog(bb_applet_name, 0, LOG_LOCAL0); | 60 | openlog(bb_applet_name, 0, LOG_LOCAL0); |
61 | vsyslog(LOG_ERR, s, ap); | 61 | vsyslog(LOG_ERR, s, ap); |
62 | closelog(); | 62 | closelog(); |
63 | } else | 63 | } else { |
64 | bb_error_msg(s, ap); | 64 | bb_verror_msg(s, ap); |
65 | 65 | putc('\n', stderr); | |
66 | } | ||
66 | va_end(ap); | 67 | va_end(ap); |
67 | 68 | ||
68 | exit(EXIT_FAILURE); | 69 | exit(EXIT_FAILURE); |
69 | } | 70 | } |
70 | 71 | ||
71 | /* Check ascii str_macaddr, convert and copy to *mac */ | 72 | /* Check ascii str_macaddr, convert and copy to *mac */ |
72 | static struct ether_addr *cc_macaddr(char *str_macaddr) | 73 | static struct ether_addr *cc_macaddr(const char *str_macaddr) |
73 | { | 74 | { |
74 | struct ether_addr *lmac, *mac; | 75 | struct ether_addr *lmac, *mac; |
75 | 76 | ||
@@ -94,7 +95,7 @@ int nameif_main(int argc, char **argv) | |||
94 | 95 | ||
95 | flags = bb_getopt_ulflags(argc, argv, "sc:", &fname); | 96 | flags = bb_getopt_ulflags(argc, argv, "sc:", &fname); |
96 | 97 | ||
97 | if (argc - optind == 1) | 98 | if ((argc - optind) & 1) |
98 | bb_show_usage(); | 99 | bb_show_usage(); |
99 | 100 | ||
100 | if (optind < argc) { | 101 | if (optind < argc) { |
@@ -120,8 +121,10 @@ int nameif_main(int argc, char **argv) | |||
120 | size_t name_length; | 121 | size_t name_length; |
121 | 122 | ||
122 | line_ptr = line + strspn(line, " \t"); | 123 | line_ptr = line + strspn(line, " \t"); |
123 | if ((line_ptr[0] == '#') || (line_ptr[0] == '\n')) | 124 | if ((line_ptr[0] == '#') || (line_ptr[0] == '\n')) { |
125 | free(line); | ||
124 | continue; | 126 | continue; |
127 | } | ||
125 | name_length = strcspn(line_ptr, " \t"); | 128 | name_length = strcspn(line_ptr, " \t"); |
126 | ch = xcalloc(1, sizeof(mactable_t)); | 129 | ch = xcalloc(1, sizeof(mactable_t)); |
127 | ch->ifname = bb_xstrndup(line_ptr, name_length); | 130 | ch->ifname = bb_xstrndup(line_ptr, name_length); |