diff options
| author | Roy Marples <roy@marples.name> | 2020-05-20 12:23:25 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-05-20 12:23:25 +0100 |
| commit | ed42d4f666a2d6a03f8ae901dd864b8db39c635c (patch) | |
| tree | 251d83467ac9df94ee2befeb8f4a91246a72b64e /src/if-bsd.c | |
| parent | b060ddf2bc7e7f4d3302a1c708394d758b52c4b4 (diff) | |
| download | dhcpcd-ed42d4f666a2d6a03f8ae901dd864b8db39c635c.tar.xz | |
OpenBSD: Fix non privsep builds.
Diffstat (limited to 'src/if-bsd.c')
| -rw-r--r-- | src/if-bsd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c index 981f9b2a..7bc1d732 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -364,17 +364,18 @@ if_linkaddr(struct sockaddr_dl *sdl, const struct interface *ifp) static int if_indirect_ioctl(struct dhcpcd_ctx *ctx, const char *ifname, unsigned long cmd, void *data, size_t len) { + struct ifreq ifr = { .ifr_flags = 0 }; -#ifdef HAVE_PLEDGE - return (int)ps_root_indirectioctl(ctx, cmd, ifname, data, len); +#if defined(PRIVSEP) && defined(HAVE_PLEDGE) + if (IN_PRIVSEP(ctx)) + return (int)ps_root_indirectioctl(ctx, cmd, ifname, data, len); #else - struct ifreq ifr = { .ifr_flags = 0 }; + UNUSED(len); +#endif strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); ifr.ifr_data = data; - UNUSED(len); return ioctl(ctx->pf_inet_fd, cmd, &ifr); -#endif } #endif |
