aboutsummaryrefslogtreecommitdiff
path: root/networking/nameif.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/nameif.c')
-rw-r--r--networking/nameif.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/networking/nameif.c b/networking/nameif.c
index f13ef1b8b..501e244b1 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -10,13 +10,7 @@
10 */ 10 */
11 11
12#include "busybox.h" 12#include "busybox.h"
13 13#include <syslog.h>
14#include <sys/syslog.h>
15#include <sys/socket.h>
16#include <sys/ioctl.h>
17#include <errno.h>
18#include <string.h>
19#include <unistd.h>
20#include <net/if.h> 14#include <net/if.h>
21#include <netinet/ether.h> 15#include <netinet/ether.h>
22 16
@@ -107,7 +101,7 @@ int nameif_main(int argc, char **argv)
107 if (strlen(*a) > IF_NAMESIZE) 101 if (strlen(*a) > IF_NAMESIZE)
108 serror("interface name `%s' too long", *a); 102 serror("interface name `%s' too long", *a);
109 ch = xzalloc(sizeof(mactable_t)); 103 ch = xzalloc(sizeof(mactable_t));
110 ch->ifname = bb_xstrdup(*a++); 104 ch->ifname = xstrdup(*a++);
111 ch->mac = cc_macaddr(*a++); 105 ch->mac = cc_macaddr(*a++);
112 if (clist) 106 if (clist)
113 clist->prev = ch; 107 clist->prev = ch;
@@ -115,7 +109,7 @@ int nameif_main(int argc, char **argv)
115 clist = ch; 109 clist = ch;
116 } 110 }
117 } else { 111 } else {
118 ifh = bb_xfopen(fname, "r"); 112 ifh = xfopen(fname, "r");
119 113
120 while ((line = bb_get_line_from_file(ifh)) != NULL) { 114 while ((line = bb_get_line_from_file(ifh)) != NULL) {
121 char *line_ptr; 115 char *line_ptr;
@@ -128,7 +122,7 @@ int nameif_main(int argc, char **argv)
128 } 122 }
129 name_length = strcspn(line_ptr, " \t"); 123 name_length = strcspn(line_ptr, " \t");
130 ch = xzalloc(sizeof(mactable_t)); 124 ch = xzalloc(sizeof(mactable_t));
131 ch->ifname = bb_xstrndup(line_ptr, name_length); 125 ch->ifname = xstrndup(line_ptr, name_length);
132 if (name_length > IF_NAMESIZE) 126 if (name_length > IF_NAMESIZE)
133 serror("interface name `%s' too long", ch->ifname); 127 serror("interface name `%s' too long", ch->ifname);
134 line_ptr += name_length; 128 line_ptr += name_length;