From: Ian Darwin Date: Fri, 28 Aug 1987 20:42:57 +0000 (+0000) Subject: Restore lost comment. Add (with #ifdef) code to print suid/sgid/sticky bits, X-Git-Tag: FILE3_27~426 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0205ccd7efb6ec1dab25d4641e42a684a2749a1c;p=file Restore lost comment. Add (with #ifdef) code to print suid/sgid/sticky bits, courtesy John Gilmore (a la SUNIX file command). --- 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);