iputils/iputils-ss021109-ifenslave-strncpy.diff

57 lines
2.1 KiB
Diff

--- ifenslave.c 2008-10-06 10:36:26.000000000 +0200
+++ ifenslave.c 2008-10-06 10:38:24.000000000 +0200
@@ -515,7 +515,7 @@
spp++;
}
- if (strncpy(if_ipaddr.ifr_name, slave_ifname, IFNAMSIZ) <= 0
+ if (strncpy(if_ipaddr.ifr_name, slave_ifname, IFNAMSIZ) == 0
|| ioctl(skfd, SIOCSIFADDR, &if_ipaddr) < 0) {
fprintf(stderr,
"Something broke setting the slave's address: %s.\n",
@@ -528,7 +528,7 @@
}
}
- if (strncpy(if_mtu.ifr_name, slave_ifname, IFNAMSIZ) <= 0
+ if (strncpy(if_mtu.ifr_name, slave_ifname, IFNAMSIZ) == 0
|| ioctl(skfd, SIOCSIFMTU, &if_mtu) < 0) {
fprintf(stderr, "Something broke setting the slave MTU: %s.\n",
strerror(errno));
@@ -537,7 +537,7 @@
printf("Set the slave's (%s) MTU to %d.\n", slave_ifname, if_mtu.ifr_mtu);
}
- if (strncpy(if_dstaddr.ifr_name, slave_ifname, IFNAMSIZ) <= 0
+ if (strncpy(if_dstaddr.ifr_name, slave_ifname, IFNAMSIZ) == 0
|| ioctl(skfd, SIOCSIFDSTADDR, &if_dstaddr) < 0) {
fprintf(stderr, "Error setting the slave (%s) with SIOCSIFDSTADDR: %s.\n",
slave_ifname, strerror(errno));
@@ -549,7 +549,7 @@
}
}
- if (strncpy(if_brdaddr.ifr_name, slave_ifname, IFNAMSIZ) <= 0
+ if (strncpy(if_brdaddr.ifr_name, slave_ifname, IFNAMSIZ) == 0
|| ioctl(skfd, SIOCSIFBRDADDR, &if_brdaddr) < 0) {
fprintf(stderr,
"Something broke setting the slave (%s) broadcast address: %s.\n",
@@ -562,7 +562,7 @@
}
}
- if (strncpy(if_netmask.ifr_name, slave_ifname, IFNAMSIZ) <= 0
+ if (strncpy(if_netmask.ifr_name, slave_ifname, IFNAMSIZ) == 0
|| ioctl(skfd, SIOCSIFNETMASK, &if_netmask) < 0) {
fprintf(stderr,
"Something broke setting the slave (%s) netmask: %s.\n",
@@ -582,7 +582,7 @@
*/
ifr2.ifr_flags |= IFF_UP;
if ((ifr2.ifr_flags &= ~(IFF_SLAVE | IFF_MASTER)) == 0
- || strncpy(ifr2.ifr_name, slave_ifname, IFNAMSIZ) <= 0
+ || strncpy(ifr2.ifr_name, slave_ifname, IFNAMSIZ) == 0
|| ioctl(skfd, SIOCSIFFLAGS, &ifr2) < 0) {
fprintf(stderr,
"Something broke setting the slave (%s) flags: %s.\n",