summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorEric Andersen2003-11-14 03:00:04 +0000
committerEric Andersen2003-11-14 03:00:04 +0000
commitc16686c1e2e29f99de34a79aed30999fd961ca70 (patch)
tree5192d845815ef38302ce9415352f2aa247931ef6 /networking
parent61b038acccba5cceb0e2c8a4662b3a40f4a29493 (diff)
downloadbusybox-c16686c1e2e29f99de34a79aed30999fd961ca70.zip
busybox-c16686c1e2e29f99de34a79aed30999fd961ca70.tar.gz
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):
Diffstat (limited to 'networking')
-rw-r--r--networking/udhcp/socket.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index f12fa92..df00e69 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);