aboutsummaryrefslogtreecommitdiff
path: root/hack/libsubid_tag.sh
blob: 137826484f85aeee963881c10713f1e6b8ebe739 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/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 -x c - -l subid > /dev/null 2> /dev/null << EOF
#include <shadow/subid.h>
#include <stdio.h>
#include <stdlib.h>

const char *Prog = "test";
FILE *shadow_logfd = NULL;

int main() {
	struct subid_range *ranges = NULL;
#if SUBID_ABI_MAJOR >= 4
	subid_get_uid_ranges("root", &ranges);
#else
	get_subuid_ranges("root", &ranges);
#endif
	free(ranges);
	return 0;
}
EOF
if test $? -eq 0 ; then
	echo libsubid
fi