From: nekral-guest Date: Fri, 28 Dec 2007 19:08:33 +0000 (+0000) Subject: I forgot the initialization of group_id in find_new_gid(). X-Git-Tag: 4.1.1~247 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da37da30e1627a5217c123a2d1ebe3c0bf4f55ba;p=shadow I forgot the initialization of group_id in find_new_gid(). --- diff --git a/src/groupadd.c b/src/groupadd.c index 7a5c138f..4a21dccc 100644 --- a/src/groupadd.c +++ b/src/groupadd.c @@ -208,6 +208,11 @@ static void find_new_gid (void) gid_min = getdef_unum ("GID_MIN", 1000); gid_max = getdef_unum ("GID_MAX", 60000); + /* + * Start with the lowest GID. + */ + group_id = gid_min; + /* * Search the entire group file, looking for the largest unused * value. @@ -404,7 +409,7 @@ static void process_flags (int argc, char **argv) * note: -K GID_MIN=10,GID_MAX=499 doesn't work yet */ cp = strchr (optarg, '='); - if (!cp) { + if (NULL == cp) { fprintf (stderr, _ ("%s: -K requires KEY=VALUE\n"), @@ -444,7 +449,7 @@ static void process_flags (int argc, char **argv) * Check if the group already exist. */ /* local, no need for xgetgrnam */ - if (getgrnam (group_name)) { + if (getgrnam (group_name) != NULL) { /* The group already exist */ if (fflg) { /* OK, no need to do anything */