aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/socket.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-02-22 02:10:34 +0000
committerRob Landley <rob@landley.net>2006-02-22 02:10:34 +0000
commite8f504e86d90b85d85f6005fa8e53a45385d07c8 (patch)
tree0d8962e3c3bc86d129c9fba431204dfb43c3cc48 /networking/udhcp/socket.c
parentd6e14d8beebb5c9571bded30df6568570f0c2a54 (diff)
downloadbusybox-e8f504e86d90b85d85f6005fa8e53a45385d07c8.tar.gz
Bug 751: file handle leaks can add up until available filehandles for the
process are exhausted.
Diffstat (limited to 'networking/udhcp/socket.c')
-rw-r--r--networking/udhcp/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 7b057523a..036885175 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -62,6 +62,7 @@ int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
DEBUG(LOG_INFO, "%s (our ip) = %s", ifr.ifr_name, inet_ntoa(our_ip->sin_addr));
} else {
LOG(LOG_ERR, "SIOCGIFADDR failed, is the interface up and configured?: %m");
+ close(fd);
return -1;
}
}
@@ -71,6 +72,7 @@ int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
*ifindex = ifr.ifr_ifindex;
} else {
LOG(LOG_ERR, "SIOCGIFINDEX failed!: %m");
+ close(fd);
return -1;
}
if (ioctl(fd, SIOCGIFHWADDR, &ifr) == 0) {
@@ -79,6 +81,7 @@ int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
arp[0], arp[1], arp[2], arp[3], arp[4], arp[5]);
} else {
LOG(LOG_ERR, "SIOCGIFHWADDR failed!: %m");
+ close(fd);
return -1;
}
} else {