]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
If test works ensure we return 0 to userland.
authorRoy Marples <roy@marples.name>
Tue, 10 Jun 2008 09:33:13 +0000 (09:33 +0000)
committerRoy Marples <roy@marples.name>
Tue, 10 Jun 2008 09:33:13 +0000 (09:33 +0000)
client.c

index 5d4dc8981a4136cbbedecc631a72539fbaa4b105..3a888c18216a4a64ac6a05b3582c7cd99d1aa6d9 100644 (file)
--- a/client.c
+++ b/client.c
@@ -948,8 +948,8 @@ handle_timeout_fail(struct if_state *state, const struct options *options)
                                logger(LOG_ERR, "timed out");
                }
                do_socket(state, SOCKET_CLOSED);
-               if (options->options & DHCPCD_INFORM ||
-                   options->options & DHCPCD_TEST)
+               if (state->options & DHCPCD_INFORM ||
+                   state->options & DHCPCD_TEST)
                        return -1;
 
                if (state->options & DHCPCD_IPV4LL ||
@@ -1337,9 +1337,11 @@ handle_dhcp_packet(struct if_state *state, const struct options *options)
                }
                free(packet);
                if (handle_dhcp(state, &dhcp, options) == 0) {
+                       /* Fake the fact we forked so we return 0 to userland */
                        if (state->options & DHCPCD_TEST)
-                               return -1;
-                       return 0;
+                               state->options |= DHCPCD_FORKED;
+                       else
+                               return 0;
                }
                if (state->options & DHCPCD_FORKED)
                        return -1;