From: Roy Marples Date: Thu, 21 Feb 2008 07:45:02 +0000 (+0000) Subject: Fix compile on NOMMU systems. X-Git-Tag: v3.2.3~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1428b446653c1015b9e1bded886087a53015e30b;p=thirdparty%2Fdhcpcd.git Fix compile on NOMMU systems. --- diff --git a/client.c b/client.c index 90b434ee..b7957f77 100644 --- a/client.c +++ b/client.c @@ -261,11 +261,12 @@ static void remove_skiproutes (dhcp_t *dhcp, interface_t *iface) { int i = -1; route_t *route; - route_t *iroute = NULL; + route_t *newroute; free_route (iface->previous_routes); + iface->previous_routes = NULL; - for (route = dhcp->routes; route; route = route->next) { + NSTAILQ_FOREACH (route, dhcp->routes, entries) { i++; /* Check that we did add this route or not */ @@ -286,15 +287,14 @@ static void remove_skiproutes (dhcp_t *dhcp, interface_t *iface) continue; } - if (! iroute) - iroute = iface->previous_routes = - xmalloc (sizeof (*iroute)); - - memcpy (iroute, route, sizeof (*iroute)); - if (route->next) { - iroute->next = xmalloc (sizeof (*iroute)); - iroute = iroute->next; + if (! iface->previous_routes) { + iface->previous_routes = xmalloc (sizeof (*iface->previous_routes)); + STAILQ_INIT (iface->previous_routes); } + + newroute = xmalloc (sizeof (*newroute)); + memcpy (newroute, route, sizeof (*newroute)); + STAILQ_INSERT_TAIL (iface->previous_routes, newroute, entries); } /* We no longer need this argument */