}
TAILQ_INIT(&state->arp_states);
} else {
- if (addr && (astate = arp_find(ifp, addr)))
+ if ((astate = arp_find(ifp, addr)) != NULL)
return astate;
}
do {
p = *buf;
+ if (*buf == NULL)
+ return NULL;
c = memchr(*buf, '\n', (size_t)*buflen);
if (c == NULL) {
c = memchr(*buf, '\0', (size_t)*buflen);
dhcp_init(struct interface *ifp)
{
struct dhcp_state *state;
- const struct if_options *ifo;
+ struct if_options *ifo;
uint8_t len;
char buf[(sizeof(ifo->clientid) - 1) * 3];
* at device start. */
return 0;
- if (ifo->options & DHCPCD_CLIENTID)
+ if (ifo->options & DHCPCD_CLIENTID && state->clientid != NULL)
logdebugx("%s: using ClientID %s", ifp->name,
hwaddr_ntoa(state->clientid + 1, state->clientid[0],
buf, sizeof(buf)));
loginfox("%s: new hardware address: %s", ifp->name,
hwaddr_ntoa(hwaddr, hwlen, buf, sizeof(buf)));
ifp->hwlen = hwlen;
- memcpy(ifp->hwaddr, hwaddr, hwlen);
+ if (hwaddr != NULL)
+ memcpy(ifp->hwaddr, hwaddr, hwlen);
}
static void
#ifdef USE_SIGNALS
for (si = 0; si < dhcpcd_signals_ignore_len; si++)
- signal(dhcpcd_signals_ignore[i], SIG_IGN);
+ signal(dhcpcd_signals_ignore[si], SIG_IGN);
/* Save signal mask, block and redirect signals to our handler */
if (eloop_signal_set_cb(ctx.eloop,
errno = e;
return -1;
}
- *ep-- = '\0';
+ *ep = '\0';
+#ifdef __sun
+ ep--;
+#endif
} else {
spec->lun = -1;
+#ifdef __sun
ep = spec->drvname + strlen(spec->drvname) - 1;
+#endif
}
strlcpy(spec->devname, spec->drvname, sizeof(spec->devname));
}
#endif
- status = script_run(ctx, argv);
+ script_run(ctx, argv);
send_listeners:
/* Send to our listeners */