summaryrefslogtreecommitdiff
path: root/networking/libiproute/iplink.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-12-02 18:18:50 +0000
committerDenis Vlasenko2008-12-02 18:18:50 +0000
commit360d9661b6a33b0358104623058f1c3629a469ea (patch)
tree268954b686b38c96428e3b74fc1ebb2ebdfdfb32 /networking/libiproute/iplink.c
parent928b2c0fee65cae10f683ee0f1ea8d0a29a54924 (diff)
downloadbusybox-360d9661b6a33b0358104623058f1c3629a469ea.zip
busybox-360d9661b6a33b0358104623058f1c3629a469ea.tar.gz
libbb: add strncpy_IFNAMSIZ
function old new delta ... udhcp_read_interface 225 220 -5 brctl_main 1151 1146 -5 add_interface 109 104 -5 ipaddr_list_or_flush 2174 2167 -7 do_add_ioctl 88 80 -8 vconfig_main 249 240 -9 do_del_ioctl 78 68 -10 do_iplink 1186 1173 -13 do_if_fetch 766 753 -13 buffer_fill_and_print 196 179 -17 parse_args 1709 1684 -25 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/20 up/down: 11/-140) Total: -129 bytes
Diffstat (limited to 'networking/libiproute/iplink.c')
-rw-r--r--networking/libiproute/iplink.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 8de17bf..d3d0338 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -41,7 +41,7 @@ static void do_chflags(char *dev, uint32_t flags, uint32_t mask)
struct ifreq ifr;
int fd;
- strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
+ strncpy_IFNAMSIZ(ifr.ifr_name, dev);
fd = get_ctl_fd();
xioctl(fd, SIOCGIFFLAGS, &ifr);
if ((ifr.ifr_flags ^ flags) & mask) {
@@ -58,8 +58,8 @@ static void do_changename(char *dev, char *newdev)
struct ifreq ifr;
int fd;
- strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
- strncpy(ifr.ifr_newname, newdev, sizeof(ifr.ifr_newname));
+ strncpy_IFNAMSIZ(ifr.ifr_name, dev);
+ strncpy_IFNAMSIZ(ifr.ifr_newname, newdev);
fd = get_ctl_fd();
xioctl(fd, SIOCSIFNAME, &ifr);
close(fd);
@@ -73,7 +73,7 @@ static void set_qlen(char *dev, int qlen)
s = get_ctl_fd();
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
+ strncpy_IFNAMSIZ(ifr.ifr_name, dev);
ifr.ifr_qlen = qlen;
xioctl(s, SIOCSIFTXQLEN, &ifr);
close(s);
@@ -87,7 +87,7 @@ static void set_mtu(char *dev, int mtu)
s = get_ctl_fd();
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
+ strncpy_IFNAMSIZ(ifr.ifr_name, dev);
ifr.ifr_mtu = mtu;
xioctl(s, SIOCSIFMTU, &ifr);
close(s);
@@ -104,7 +104,7 @@ static int get_address(char *dev, int *htype)
s = xsocket(PF_PACKET, SOCK_DGRAM, 0);
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
+ strncpy_IFNAMSIZ(ifr.ifr_name, dev);
xioctl(s, SIOCGIFINDEX, &ifr);
memset(&me, 0, sizeof(me));
@@ -128,7 +128,7 @@ static void parse_address(char *dev, int hatype, int halen, char *lla, struct if
int alen;
memset(ifr, 0, sizeof(*ifr));
- strncpy(ifr->ifr_name, dev, sizeof(ifr->ifr_name));
+ strncpy_IFNAMSIZ(ifr->ifr_name, dev);
ifr->ifr_hwaddr.sa_family = hatype;
alen = hatype == 1/*ARPHRD_ETHER*/ ? 14/*ETH_HLEN*/ : 19/*INFINIBAND_HLEN*/;