Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-0]: src/usr.sbin/user Pull up revision 1.80 (requested by agc i...



details:   https://anonhg.NetBSD.org/src/rev/6a9b89ccc648
branches:  netbsd-2-0
changeset: 564803:6a9b89ccc648
user:      riz <riz%NetBSD.org@localhost>
date:      Tue Jul 05 19:06:57 2005 +0000

description:
Pull up revision 1.80 (requested by agc in ticket #2024):
Be consistent when deleting a non-existent group - tell if the group is
non-existent.
Problem noted by Geert Hendrickx, fix from Liam J. Foy.

diffstat:

 usr.sbin/user/user.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 02aff3b25c45 -r 6a9b89ccc648 usr.sbin/user/user.c
--- a/usr.sbin/user/user.c      Fri Jul 01 15:15:23 2005 +0000
+++ b/usr.sbin/user/user.c      Tue Jul 05 19:06:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.75 2004/01/14 09:35:33 agc Exp $ */
+/* $NetBSD: user.c,v 1.75.2.1 2005/07/05 19:06:57 riz Exp $ */
 
 /*
  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
@@ -35,7 +35,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1999 \
                The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: user.c,v 1.75 2004/01/14 09:35:33 agc Exp $");
+__RCSID("$NetBSD: user.c,v 1.75.2.1 2005/07/05 19:06:57 riz Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1977,6 +1977,9 @@
        if (argc != 1) {
                usermgmt_usage("groupdel");
        }
+       if (getgrnam(*argv) == NULL) {
+               errx(EXIT_FAILURE, "No such group `%s'", *argv);
+       }
        checkeuid();
        openlog("groupdel", LOG_PID, LOG_USER);
        if (!modify_gid(*argv, NULL)) {
@@ -2044,7 +2047,7 @@
                err(EXIT_FAILURE, "Duplicate which gid?");
        }
        if ((grp = getgrnam(*argv)) == NULL) {
-               err(EXIT_FAILURE, "can't find group `%s' to modify", *argv);
+               errx(EXIT_FAILURE, "can't find group `%s' to modify", *argv);
        }
        if (!is_local(*argv, _PATH_GROUP)) {
                errx(EXIT_FAILURE, "Group `%s' must be a local group", *argv);



Home | Main Index | Thread Index | Old Index