From dffae6b422767f994e05fc232c42d6918f39aa10 Mon Sep 17 00:00:00 2001 From: ru Date: Wed, 22 Sep 1999 13:02:50 +0000 Subject: If `who' was not specified, set the appropriate bits as the chmod(1) manual page states. `chmod +s foo' and `chmod +t foodir' now work. PR: 13889 --- lib/libc/gen/setmode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c index c69d775..0bbf22d 100644 --- a/lib/libc/gen/setmode.c +++ b/lib/libc/gen/setmode.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94"; +#endif +static const char rcsid[] = + "$FreeBSD$"; #endif /* LIBC_SCCS and not lint */ #include @@ -255,12 +259,12 @@ getop: if ((op = *p++) != '+' && op != '-' && op != '=') { break; case 's': /* If only "other" bits ignore set-id. */ - if (who & ~S_IRWXO) + if (!who || who & ~S_IRWXO) perm |= S_ISUID|S_ISGID; break; case 't': /* If only "other" bits ignore sticky. */ - if (who & ~S_IRWXO) { + if (!who || who & ~S_IRWXO) { who |= S_ISTXT; perm |= S_ISTXT; } -- cgit v1.1