From 9fe23b2e8e105d0cbc9f3a7cab344fadf8ce1e78 Mon Sep 17 00:00:00 2001 From: andersen Date: Fri, 14 Nov 2003 03:00:04 +0000 Subject: Ulrich Marx writes: hello i had some trouble with the filedescriptor in udhcp. Two things happened on my device: 1.) broken or not connected cable (no dhcp-server) 2.) daemonizing (starting with option -b) i got a filedescriptor fd=0 from function raw_socket, after daemonizing (daemon call) the fd is closed. Client can't recieve data's anymore. i fixed this problem (like pidfile handling): git-svn-id: svn://busybox.net/trunk/busybox@7903 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- networking/udhcp/socket.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'networking/udhcp/socket.c') diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c index f12fa9290..df00e6985 100644 --- a/networking/udhcp/socket.c +++ b/networking/udhcp/socket.c @@ -141,6 +141,8 @@ int raw_socket(int ifindex) DEBUG(LOG_ERR, "socket call failed: %m"); return -1; } + + while (fd >= 0 && fd < 3) fd = dup(fd); /* don't let daemon close fds on us */ sock.sll_family = AF_PACKET; sock.sll_protocol = htons(ETH_P_IP); -- cgit v1.2.3-55-g6feb