summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-09-05 07:31:09 +0000
committerRoy Marples <roy@marples.name>2008-09-05 07:31:09 +0000
commite7eeaf88da7f1512b33847d180288f4158ef6bd4 (patch)
tree52215aeb2689bcd884e6477039e7b8dbc3f37eae /dhcpcd.c
parentda16617840a22827d78c99bab837d9be0a420c7c (diff)
downloaddhcpcd-e7eeaf88da7f1512b33847d180288f4158ef6bd4.tar.xz
Make TEST work once more.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 02315798..3094fd2b 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -457,13 +457,17 @@ handle_dhcp(struct interface *iface, struct dhcp_message **dhcpp)
lease->addr.s_addr = dhcp->yiaddr;
get_option_addr(&lease->server.s_addr, dhcp, DHO_SERVERID);
log_dhcp(LOG_INFO, "offered", iface, dhcp);
- if (ifo->options & DHCPCD_TEST) {
- run_script(iface, "TEST");
- exit(EXIT_SUCCESS);
- }
free(state->offer);
state->offer = dhcp;
*dhcpp = NULL;
+ if (options & DHCPCD_TEST) {
+ free(state->old);
+ state->old = state->new;
+ state->new = state->offer;
+ state->offer = NULL;
+ run_script(iface, "TEST");
+ exit(EXIT_SUCCESS);
+ }
delete_timeout(send_discover, iface);
if (ifo->options & DHCPCD_ARP &&
iface->addr.s_addr != state->offer->yiaddr)
@@ -1029,7 +1033,7 @@ main(int argc, char **argv)
/* If we have any other args, we should run as a single dhcpcd instance
* for that interface. */
- if (optind == argc - 1)
+ if (optind == argc - 1 && !(options & DHCPCD_TEST))
snprintf(pidfile, sizeof(pidfile), PIDFILE, "-", argv[optind]);
else {
snprintf(pidfile, sizeof(pidfile), PIDFILE, "", "");