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):
This commit is contained in:
Eric Andersen 2003-11-14 03:00:04 +00:00
parent 61b038accc
commit c16686c1e2

View File

@ -142,6 +142,8 @@ int raw_socket(int ifindex)
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);
sock.sll_ifindex = ifindex;