aboutsummaryrefslogtreecommitdiff
path: root/io/tst-fchownat.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-03-08 05:21:41 +0000
committerUlrich Drepper <drepper@redhat.com>2008-03-08 05:21:41 +0000
commitc71665ad060cd30c99399d7a4fa47566eaf8b961 (patch)
tree8a4519cb1d91bb2abcf273e8a1cb5452ec5f4d2c /io/tst-fchownat.c
parent72f1012788c07837e841300024ab554b56aa6816 (diff)
downloadglibc-c71665ad060cd30c99399d7a4fa47566eaf8b961.zip
glibc-c71665ad060cd30c99399d7a4fa47566eaf8b961.tar.gz
glibc-c71665ad060cd30c99399d7a4fa47566eaf8b961.tar.bz2
* io/tst-fchownat.c: Correctly handle _POSIX_CHOWN_RESTRICTED
defined to zero.
Diffstat (limited to 'io/tst-fchownat.c')
-rw-r--r--io/tst-fchownat.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/io/tst-fchownat.c b/io/tst-fchownat.c
index fd32ac9..da8fd3b 100644
--- a/io/tst-fchownat.c
+++ b/io/tst-fchownat.c
@@ -19,14 +19,17 @@ static int dir_fd;
static void
prepare (void)
{
-#if _POSIX_CHOWN_RESTRICTED > 0
- uid_t uid = getuid ();
- if (uid != 0)
+#if _POSIX_CHOWN_RESTRICTED == 0
+ if (pathconf (test_dir, _PC_CHOWN_RESTRICTED) != 0)
+#endif
{
- puts ("need root privileges");
- exit (0);
+ uid_t uid = getuid ();
+ if (uid != 0)
+ {
+ puts ("need root privileges");
+ exit (0);
+ }
}
-#endif
size_t test_dir_len = strlen (test_dir);
static const char dir_name[] = "/tst-fchownat.XXXXXX";