sdhcp

simple dhcp client
git clone git://git.2f30.org/sdhcp.git
Log | Files | Refs | LICENSE

commit 4716991b7cf1cf79d3ddf27b16690ccb37e863b7
parent 462f43e6073a740dfb71e720ace9d7f041e36b36
Author: Michael Forney <mforney@mforney.org>
Date:   Mon Apr 27 01:00:02 +0000

Only fork once

Diffstat:
sdhcp.c | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sdhcp.c b/sdhcp.c @@ -339,6 +339,8 @@ acceptlease(void) static void run(void) { + int forked = 0; + #if 0 InitReboot: /* send DHCPrequest to old server */ @@ -390,8 +392,11 @@ Requesting: } Bound: fputs("Congrats! You should be on the 'net.\n", stdout); - if(fork()) - exit(EXIT_SUCCESS); + if(!forked) { + if(fork()) + exit(EXIT_SUCCESS); + forked = 1; + } switch (dhcprecv()) { case DHCPoffer: case DHCPack: