newuidmap,newgidmap: Correct the range size sanity check in get_map_ranges

The number of ranges should be the ceiling of the number of arguments divided
by three.

Without this fix newuidmap and newgidmap always report and error and fail,
which is very much not what we want.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Eric W. Biederman
2013-09-08 02:49:52 -07:00
committed by Serge Hallyn
parent 5e87ff0615
commit c619f379a9
+1 -1
View File
@@ -47,7 +47,7 @@ struct map_range *get_map_ranges(int ranges, int argc, char **argv)
return NULL;
}
if (ranges != ((argc - 2) + 2) / 3) {
if (ranges != ((argc + 2) / 3)) {
fprintf(stderr, "%s: ranges: %u is wrong for argc: %d\n", Prog, ranges, argc);
return NULL;
}