diff options
author | tjr <tjr@FreeBSD.org> | 2002-06-02 09:32:39 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-06-02 09:32:39 +0000 |
commit | 58f72955684f483938537fa04e5033aa76f32238 (patch) | |
tree | 7420d607d5c88a2972c33f2d8d78912e71cbbba4 /usr.sbin | |
parent | 0930ee47eb7101dfdad2719e91488e3b5a122ecd (diff) | |
download | FreeBSD-src-58f72955684f483938537fa04e5033aa76f32238.zip FreeBSD-src-58f72955684f483938537fa04e5033aa76f32238.tar.gz |
Don't exit immediately if an error occurs, continue but exit non-zero.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/chown/chown.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/chown/chown.c b/usr.sbin/chown/chown.c index 6f5f390..b015458 100644 --- a/usr.sbin/chown/chown.c +++ b/usr.sbin/chown/chown.c @@ -255,17 +255,21 @@ chownerr(file) gid_t groups[NGROUPS_MAX]; /* Check for chown without being root. */ - if (errno != EPERM || - (uid != (uid_t)-1 && euid == (uid_t)-1 && (euid = geteuid()) != 0)) - err(1, "%s", file); + if (errno != EPERM || (uid != (uid_t)-1 && + euid == (uid_t)-1 && (euid = geteuid()) != 0)) { + warn("%s", file); + return; + } /* Check group membership; kernel just returns EPERM. */ if (gid != (gid_t)-1 && ngroups == -1 && euid == (uid_t)-1 && (euid = geteuid()) != 0) { ngroups = getgroups(NGROUPS_MAX, groups); while (--ngroups >= 0 && gid != groups[ngroups]); - if (ngroups < 0) - errx(1, "you are not a member of group %s", gname); + if (ngroups < 0) { + warnx("you are not a member of group %s", gname); + return; + } } warn("%s", file); } |