---
gdhcp/client.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/gdhcp/client.c b/gdhcp/client.c
index e6106d1..922be92 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -1207,7 +1207,7 @@ error:
static int dhcp_l2_socket(int ifindex)
{
- int fd;
+ int fd, err;
struct sockaddr_ll sock;
/*
@@ -1258,7 +1258,7 @@ static int dhcp_l2_socket(int ifindex)
fd = socket(PF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC, htons(ETH_P_IP));
if (fd < 0)
- return fd;
+ return -errno;
if (SERVER_PORT == 67 && CLIENT_PORT == 68)
/* Use only if standard ports are in use */
@@ -1271,8 +1271,9 @@ static int dhcp_l2_socket(int ifindex)
sock.sll_ifindex = ifindex;
if (bind(fd, (struct sockaddr *) &sock, sizeof(sock)) != 0) {
+ err = -errno;
close(fd);
- return -errno;
+ return err;
}
return fd;
--
1.7.10.4
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman