0
1
mirror of https://github.com/termux/proot.git synced 2024-11-11 13:49:26 +00:00
proot/tests/test-1c68c218.c
2016-08-21 07:42:00 -04:00

26 lines
452 B
C

#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
int status;
char *path;
path = tmpnam(NULL);
status = symlink(path, path);
if (status < 0)
exit(EXIT_FAILURE);
status = fchownat(AT_FDCWD, path, getuid(), getgid(), 0);
if (status >= 0)
exit(EXIT_FAILURE);
status = fchownat(AT_FDCWD, path, getuid(), getgid(), AT_SYMLINK_NOFOLLOW);
if (status < 0)
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
}