From 0205ccd7efb6ec1dab25d4641e42a684a2749a1c Mon Sep 17 00:00:00 2001 From: Ian Darwin Date: Fri, 28 Aug 1987 20:42:57 +0000 Subject: [PATCH] Restore lost comment. Add (with #ifdef) code to print suid/sgid/sticky bits, courtesy John Gilmore (a la SUNIX file command). --- src/fsmagic.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fsmagic.c b/src/fsmagic.c index 541a3545..588c6591 100644 --- a/src/fsmagic.c +++ b/src/fsmagic.c @@ -7,7 +7,7 @@ #ifndef major /* if `major' not defined in types.h, */ #include /* try this one. */ #endif -#ifndef major +#ifndef major /* still not defined? give up, manual intervention needed */ /* If cc tries to compile this, read and act on it. */ /* On most systems cpp will discard it automatically */ Congratulations, you have found a portability bug. @@ -42,6 +42,13 @@ char *fn; warning("can't stat"); return -1; } + +#ifdef PRINT_STAT_BITS + if (statbuf.st_mode & S_ISUID) ckfputs("suid ", stdout); + if (statbuf.st_mode & S_ISGID) ckfputs("sgid ", stdout); + if (statbuf.st_mode & S_ISVTX) ckfputs("sticky ", stdout); +#endif /* PRINT_STAT_BITS */ + switch (statbuf.st_mode & S_IFMT) { case S_IFDIR: ckfputs("directory", stdout); -- 2.40.0