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 authored and Serge Hallyn committed 2013-09-10 17:51:40 -05:00
1 parent 5e87ff0615
commit 578947e661
1 file changed
+1 -1
+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;
}