From: "Theo de Raadt" Subject: Re: arp: print errno on failure To: Klemens Nanni Cc: OpenBSD tech Date: Thu, 09 Apr 2026 16:12:48 -0600 You are not showing how it looks, or what errors it shows. If the errors it shows are completely redundant information, then this is pointless. But why should we do the work of doing that? Did you leave that information out intentionally? > Here's an old diff, I don't remember whether I hit it or it just stood out. > > getifaddrs(3) sets errno and arp.c:send_frame() also returns it, > only for errx(3) to throw it away; that seems wrong. > > Feedback? OK? > > Less braces/return make it a net negative diff. > > Index: arp.c > =================================================================== > RCS file: /cvs/src/usr.sbin/arp/arp.c,v > diff -u -p -r1.89 arp.c > --- arp.c 4 Apr 2023 21:18:04 -0000 1.89 > +++ arp.c 4 Nov 2025 23:25:12 -0000 > @@ -808,7 +808,7 @@ wake(const char *ether_addr, const char > > if (iface == NULL) { > if (getifaddrs(&ifa) == -1) > - errx(1, "Could not get interface addresses."); > + err(1, "Could not get interface addresses"); > > for (ifap = ifa; ifap != NULL; ifap = ifap->ifa_next){ > if (pname && !strcmp(pname, ifap->ifa_name)) > @@ -848,7 +848,7 @@ do_wakeup(const char *eaddr, const char > if (bind_if_to_bpf(iface, bpf) != 0) > errx(1, "Failed to bind %s to bpf.", iface); > if (send_frame(bpf, &macaddr) != 0) > - errx(1, "Failed to send WoL frame on %s", iface); > + err(1, "Failed to send WoL frame on %s", iface); > return 0; > } > > @@ -880,10 +880,8 @@ get_ether(const char *text, struct ether > if (eaddr == NULL) { > if (ether_hostton(text, addr)) > return -1; > - } else { > + } else > *addr = *eaddr; > - return 0; > - } > > return 0; > } >