From 5cd73faeab6fb6533b2eb0dfdabf996e9d2da348 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sat, 12 Sep 2015 13:14:27 +0000 Subject: [PATCH] Fix compile on Bitrig --- configure | 2 ++ if.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 0c8513e0..a72db2ae 100755 --- a/configure +++ b/configure @@ -336,6 +336,8 @@ CFLAGS+= -Wpointer-sign -Wmissing-noreturn EOF case "$OS" in mirbsd*|openbsd*);; # OpenBSD has many redundant decs in system headers + bitrig*) echo "CFLAGS+= -Wredundant-decls" >>$CONFIG_MK + ;; # Bitrig spouts many conversion errors with htons *) echo "CFLAGS+= -Wredundant-decls" >>$CONFIG_MK echo "CFLAGS+= -Wconversion" >>$CONFIG_MK ;; diff --git a/if.c b/if.c index 6c450b99..0df8ce3a 100644 --- a/if.c +++ b/if.c @@ -520,7 +520,7 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv) memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); if (ioctl(ctx->pf_inet_fd, SIOCGIFPRIORITY, &ifr) == 0) - ifp->metric = ifr.ifr_metric; + ifp->metric = (unsigned int)ifr.ifr_metric; #else /* We reserve the 100 range for virtual interfaces, if and when * we can work them out. */ @@ -675,11 +675,11 @@ xsocket(int domain, int type, int protocol, int flags) if ((s = socket(domain, type, protocol)) == -1) return -1; - if ((flags & O_CLOEXEC) && (xflags = fcntl(s, F_GETFD, 0)) == -1 || - fcntl(s, F_SETFD, xflags | FD_CLOEXEC) == -1) + if ((flags & O_CLOEXEC) && ((xflags = fcntl(s, F_GETFD, 0)) == -1 || + fcntl(s, F_SETFD, xflags | FD_CLOEXEC) == -1)) goto out; - if ((flags & O_NONBLOCK) && (xflags = fcntl(s, F_GETFL, 0)) == -1 || - fcntl(s, F_SETFL, xflags | O_NONBLOCK) == -1) + if ((flags & O_NONBLOCK) && ((xflags = fcntl(s, F_GETFL, 0)) == -1 || + fcntl(s, F_SETFL, xflags | O_NONBLOCK) == -1)) goto out; return s; out: -- 2.47.3