Fix Build Fail with GCC8

This commit is contained in:
FlyingheartCN
2018-05-04 01:41:36 +08:00
parent eb53d54334
commit 662b6db3f3
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ setinterface(int socket_fd, const char *interface_name)
{
struct ifreq interface;
memset(&interface, 0, sizeof(struct ifreq));
strncpy(interface.ifr_name, interface_name, IFNAMSIZ);
strncpy(interface.ifr_name, interface_name, IFNAMSIZ-1);
int res = setsockopt(socket_fd, SOL_SOCKET, SO_BINDTODEVICE, &interface,
sizeof(struct ifreq));
return res;