diff options
author | Steve Price <steve@FreeBSD.org> | 1997-08-24 02:10:29 +0000 |
---|---|---|
committer | Steve Price <steve@FreeBSD.org> | 1997-08-24 02:10:29 +0000 |
commit | 573414e0c17b0c97f1f8f660a0aa73fbb7443078 (patch) | |
tree | aebf990035731887279d0a198001c1c95f6872a1 | |
parent | b74ad5265d28859d749e1afaa082032998283232 (diff) | |
download | src-573414e0c17b0c97f1f8f660a0aa73fbb7443078.tar.gz src-573414e0c17b0c97f1f8f660a0aa73fbb7443078.zip |
Correct error message when the superuser tries to change
the group of immutable files.
PR: bin/3445
Submitted by: Pius Fischer <pius@ienet.com>
Notes
Notes:
svn path=/head/; revision=28643
-rw-r--r-- | usr.sbin/chown/chown.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/usr.sbin/chown/chown.c b/usr.sbin/chown/chown.c index 2a24547f1055..c7b171b1c605 100644 --- a/usr.sbin/chown/chown.c +++ b/usr.sbin/chown/chown.c @@ -32,13 +32,18 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1988, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)chown.c 8.8 (Berkeley) 4/4/94"; +#else +static const char rcsid[] = + "$Id$"; +#endif #endif /* not lint */ #include <sys/param.h> @@ -244,25 +249,18 @@ chownerr(file) /* Check for chown without being root. */ if (errno != EPERM || - uid != -1 && euid == -1 && (euid = geteuid()) != 0) { - if (fflag) - exit(0); + (uid != -1 && euid == -1 && (euid = geteuid()) != 0)) err(1, "%s", file); - } /* Check group membership; kernel just returns EPERM. */ - if (gid != -1 && ngroups == -1) { + if (gid != -1 && ngroups == -1 && + euid == -1 && (euid = geteuid()) != 0) { ngroups = getgroups(NGROUPS, groups); while (--ngroups >= 0 && gid != groups[ngroups]); - if (ngroups < 0) { - if (fflag) - exit(0); + if (ngroups < 0) errx(1, "you are not a member of group %s", gname); - } } - - if (!fflag) - warn("%s", file); + warn("%s", file); } void |