blob: b4b981392fc9db86dccd8c5e2d3b27209ccbf9ac [file] [log] [blame]
Dmitry V. Levin1da7c952014-12-13 18:24:13 +00001#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4#include <assert.h>
5#include <unistd.h>
6#include <sys/syscall.h>
7
8int
9main(void)
10{
11#if defined(__NR_getuid) \
12 && defined(__NR_setuid) \
13 && defined(__NR_getresuid) \
14 && defined(__NR_setreuid) \
15 && defined(__NR_setresuid) \
16 && defined(__NR_chown)
17 uid_t r, e, s;
18
19 e = syscall(__NR_getuid);
20 assert(syscall(__NR_setuid, e) == 0);
21 assert(syscall(__NR_getresuid, &r, &e, &s) == 0);
22 assert(syscall(__NR_setreuid, -1, -1L) == 0);
23 assert(syscall(__NR_setresuid, -1, e, -1L) == 0);
24 assert(syscall(__NR_chown, ".", -1, -1L) == 0);
25 return 0;
26#else
27 return 77;
28#endif
29}