summaryrefslogtreecommitdiff
path: root/libmisc/find_new_gid.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmisc/find_new_gid.c')
-rw-r--r--libmisc/find_new_gid.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libmisc/find_new_gid.c b/libmisc/find_new_gid.c
index 666b6107..65ab5d01 100644
--- a/libmisc/find_new_gid.c
+++ b/libmisc/find_new_gid.c
@@ -60,6 +60,13 @@ static int get_ranges (bool sys_group, gid_t *min_id, gid_t *max_id,
(unsigned long) *max_id);
return EINVAL;
}
+ /*
+ * Zero is reserved for root and the allocation algorithm does not
+ * work right with it.
+ */
+ if (*min_id == 0) {
+ *min_id = (gid_t) 1;
+ }
} else {
/* Non-system groups */