opendoas

A portable version of the OpenBSD `doas` command
git clone https://pi.duncano.de/git/opendoas.git
Log | Files | Refs | README | LICENSE

commit 673f187858a3b10aae4e41b190ca04f6f85c99f1
parent 8558e5d1f9162b66bf09820ae1281522700fe283
Author: Duncaen <mail@duncano.de>
Date:   Sat,  7 May 2016 19:00:42 +0200

Fix typos and configure pledge detection

Diffstat:
bsd.prog.mk | 2+-
configure | 20+++++++++++++-------
2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/bsd.prog.mk b/bsd.prog.mk @@ -21,7 +21,7 @@ ${PROG}: ${OBJS} libopenbsd.a chown ${BINOWN}:${BINGRP} $@ chmod ${BINMODE} $@ -${DESTRDIR}${BINDIR} ${DESTRDIR}${PAMDIR}: +${DESTDIR}${BINDIR} ${DESTDIR}${PAMDIR}: mkdir -pm 0755 $@ ${DESTDIR}${BINDIR}/${PROG}: .${PROG}.chmod ${BINDIR} diff --git a/configure b/configure @@ -85,14 +85,18 @@ check_func() { func="$1"; src="$2"; shift 2 printf 'Checking for %-14s\t\t' "$func ..." printf '%s\n' "$src" >"_$func.c" - if $XCC "_$func.c" -o "_$func" 2>/dev/null; then + $XCC "_$func.c" -o "_$func" 2>/dev/null + ret=$? + rm -f "_$func.c" "_$func" + if [ $ret -eq 0 ]; then printf 'yes.\n' upperfunc="$(printf '%s\n' "$func" | tr '[[:lower:]]' '[[:upper:]]')" printf 'CFLAGS += -DHAVE_%s\n' "$upperfunc" >>$CONFIG_MK + return 0 else printf 'no.\n' + return 1 fi - rm -f "_$func.c" "_$func" } src=' @@ -114,7 +118,7 @@ src=' int main(void) { const char s1[] = "foo"; char s2[10]; - strlccat(s2, s1, sizeof(s2)); + strlcat(s2, s1, sizeof(s2)); return 0; }' check_func "strlcat" "$src" || { @@ -291,10 +295,12 @@ int main(void) { prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL); return 0; }' -if [ -n "$have_pledge" -a -n "$BUILD_SECCOMP" ]; then - check_func "seccomp_h" "$src" && { +[ -z "$have_pledge" -a -n "$BUILD_SECCOMP" ] && \ + check_func "seccomp_h" "$src" && \ + { + have_pledge=1 printf 'OPENBSD += pledge-seccomp.c\n' >>$CONFIG_MK } -elif [ -n "$have_pledge" ]; then + +[ -z "$have_pledge" ] && \ printf 'OPENBSD += pledge-noop.c\n' >>$CONFIG_MK -fi