aboutsummaryrefslogtreecommitdiff
path: root/hack/libsubid_tag.sh
blob: ab6af9e30d0c02858dc5ef186019ddd88142c2a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash
if test $(${GO:-go} env GOOS) != "linux" ; then
	exit 0
fi
tmpdir="$PWD/tmp.$RANDOM"
mkdir -p "$tmpdir"
trap 'rm -fr "$tmpdir"' EXIT
cc -o "$tmpdir"/libsubid_tag -l subid -x c - > /dev/null 2> /dev/null << EOF
#include <shadow/subid.h>
int main() {
	struct subid_range *ranges = NULL;
	get_subuid_ranges("root", &ranges);
	free(ranges);
	return 0;
}
EOF
if test $? -eq 0 ; then
	echo libsubid
fi