Subject: Re: groupdel gives no error like userdel does
To: Liam J. Foy <liamfoy@sepulcrum.org>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-userlevel
Date: 06/14/2005 19:30:34
Thanks, I checked in your fixes.
Regards,
Alistair
On Tue, Jun 14, 2005 at 06:22:15PM +0100, Liam J. Foy wrote:
> I also fixed another getgrnam call (doesn't set errno)
>
>
> --- user.c.old 2005-06-14 17:25:10.000000000 +0100
> +++ user.c 2005-06-14 18:18:10.000000000 +0100
> @@ -1990,6 +1990,10 @@
> 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)) {
> @@ -2057,7 +2061,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, "No such group `%s'", *argv);
> }
> if (!is_local(*argv, _PATH_GROUP)) {
> errx(EXIT_FAILURE, "Group `%s' must be a local group", *argv);
> --
> - Liam J. Foy
> liamfoy@sepulcrum.org