Print this page
4078 groupadd execs getent unnecessarily
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Reviewed by: Milan Jurik <milan.jurik@xylab.cz>
Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>
@@ -25,25 +25,27 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013 RackTop Systems.
+ */
#include <sys/types.h>
+#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include <userdefs.h>
#include <users.h>
#include <errno.h>
+#include <libcmdutils.h>
#include "messages.h"
extern int errmsg();
-extern gid_t findnextgid();
extern int valid_gid(), add_group();
/*
* groupadd [-g gid [-o]] group
*
@@ -134,11 +136,11 @@
}
} else {
- if ((gid = findnextgid()) < 0) {
+ if (findnextgid(DEFRID+1, MAXUID, &gid) != 0) {
errmsg(M_GID_INVALID, "default id");
exit(EX_ID_EXISTS);
}
}