mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-10-21 11:39:39 +00:00
Simplify and correct bindtodevice().
This commit is contained in:
1 parent
be9a74d2f8
commit
486bcd5a7b
1 file changed
+1
-4
+1
-4
@@ -485,11 +485,8 @@ char *whichdevice(void)
|
||||
|
||||
void bindtodevice(char *device, int fd)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
|
||||
strcpy(ifr.ifr_name, device);
|
||||
/* only allowed by root. */
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr)) == -1 &&
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, device, IFNAMSIZ) == -1 &&
|
||||
errno != EPERM)
|
||||
die(_("failed to set SO_BINDTODEVICE on DHCP socket: %s"), NULL, EC_BADNET);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user