summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-07-23 03:58:31 +0000
committerJim Meyering <jim@meyering.net>1994-07-23 03:58:31 +0000
commiteebb80a187ed3c2b7e4bbe6ee865179991773d2c (patch)
tree8b764ce01b94e4eee40d1847f81d44cc3ff08c01 /src
parentfc0bbac46388dbd8f0cdb19ce0be7c7e4d5f2f97 (diff)
downloadcoreutils-eebb80a187ed3c2b7e4bbe6ee865179991773d2c.tar.xz
(unary_operator): (-u, -g): Return false if S_ISUID,S_ISGID etc aren't defined.
Diffstat (limited to 'src')
-rw-r--r--src/test.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/test.c b/src/test.c
index 9421fea10..4fc35bbaf 100644
--- a/src/test.c
+++ b/src/test.c
@@ -824,23 +824,31 @@ unary_operator ()
case 'u': /* File is setuid? */
unary_advance ();
+#ifndef S_ISUID
+ return (FALSE);
+#else
if (test_stat (argv[pos - 1], &stat_buf) < 0)
return (FALSE);
return (TRUE == (0 != (stat_buf.st_mode & S_ISUID)));
+#endif
case 'g': /* File is setgid? */
unary_advance ();
+#ifndef S_ISGID
+ return (FALSE);
+#else
if (test_stat (argv[pos - 1], &stat_buf) < 0)
return (FALSE);
return (TRUE == (0 != (stat_buf.st_mode & S_ISGID)));
+#endif
case 'k': /* File has sticky bit set? */
unary_advance ();
if (test_stat (argv[pos - 1], &stat_buf) < 0)
return (FALSE);
-#if !defined (S_ISVTX)
+#ifndef S_ISVTX
/* This is not Posix, and is not defined on some Posix systems. */
return (FALSE);
#else