2 * Check decoding of fchownat syscall.
4 * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
5 * Copyright (c) 2016-2019 The strace developers.
8 * SPDX-License-Identifier: GPL-2.0-or-later
15 #if defined __NR_fchownat && defined AT_FDCWD && defined AT_SYMLINK_NOFOLLOW
23 static const char sample[] = "fchownat_sample";
24 uid_t uid = geteuid();
25 uid_t gid = getegid();
27 if (open(sample, O_RDONLY | O_CREAT, 0400) == -1)
28 perror_msg_and_fail("open");
30 long rc = syscall(__NR_fchownat, AT_FDCWD, sample, uid, gid, 0);
31 printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0) = %s\n",
32 sample, uid, gid, sprintrc(rc));
35 perror_msg_and_fail("unlink");
37 rc = syscall(__NR_fchownat, AT_FDCWD,
38 sample, -1, -1L, AT_SYMLINK_NOFOLLOW);
39 printf("fchownat(AT_FDCWD, \"%s\", -1, -1, AT_SYMLINK_NOFOLLOW) = %s\n",
40 sample, sprintrc(rc));
42 puts("+++ exited with 0 +++");
48 SKIP_MAIN_UNDEFINED("__NR_fchownat && AT_FDCWD && AT_SYMLINK_NOFOLLOW")