I forgot the initialization of group_id in find_new_gid().
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 28 Dec 2007 19:08:33 +0000 (19:08 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 28 Dec 2007 19:08:33 +0000 (19:08 +0000)
src/groupadd.c

index 7a5c138f989ef3c96f6f42269c33ed5fc85fb7d5..4a21dccc32e101ecfa3c37423957d548d299ebf6 100644 (file)
@@ -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 */