diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2019-12-07 08:04:58 -0800 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2019-12-07 08:51:11 -0800 |
commit | e305dd20d7bca17ac84cb3c8c7869d3fbd181ecd (patch) | |
tree | b50c4ab14da8789909e823825d5286c090ba2fc0 /go | |
parent | b2b267ef1c83f1f3d3105a4bb84f8bebbc130dec (diff) | |
download | libcap-e305dd20d7bca17ac84cb3c8c7869d3fbd181ecd.tar.gz |
Add a failure test case to libcap/psx Go package.
Also, need to force CGO_ENABLED=0 to take advantage of pure
Go support for syscall.PosixSyscall when available (ie. for
web.go in this tree).
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Diffstat (limited to 'go')
-rw-r--r-- | go/Makefile | 2 | ||||
-rwxr-xr-x | go/cgo-required.sh | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/go/Makefile b/go/Makefile index 363b664..31906fc 100644 --- a/go/Makefile +++ b/go/Makefile @@ -48,7 +48,7 @@ compare-cap: compare-cap.go $(CAPGOPACKAGE) CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(realpath .) go build $< web: web.go $(CAPGOPACKAGE) - CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(realpath .) go build $< + CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(realpath .) go build $< clean: GOPATH=$(realpath .) go clean -x -i libcap/cap 2> /dev/null || exit 0 diff --git a/go/cgo-required.sh b/go/cgo-required.sh new file mode 100755 index 0000000..8f22d43 --- /dev/null +++ b/go/cgo-required.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Runtime check for whether or not syscall.PosixSyscall is available to +# the working go runtime or not. If it isn't we always have to use +# libcap/psx to get POSIX semantics for syscalls that change security +# state. + +if [ -z "$(go doc syscall 2>/dev/null|grep PosixSyscall)" ]; then + echo "1" +else + echo "0" +fi |