Guard against potentially rounding to 0 when choosing sorting unit

This commit is contained in:
Eric Fischer 2017-02-17 14:14:55 -08:00
parent 1b68dcdc22
commit 9c1f2b2123

View File

@ -708,6 +708,9 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
unit = max_unit;
}
unit = ((unit + page - 1) / page) * page;
if (unit < page) {
unit = page;
}
size_t nmerges = (indexpos + unit - 1) / unit;
struct mergelist merges[nmerges];