Fix handling of boundaries.

* lib/subordinateio.c: Fix handling of boundaries.
	* libmisc/find_new_sub_uids.c: Likewise.
	* libmisc/find_new_sub_gids.c: Likewise.
This commit is contained in:
Nicolas François
2013-08-13 00:11:24 +02:00
parent d9d1bb4acb
commit bfbd83239e
4 changed files with 10 additions and 4 deletions

View File

@@ -228,7 +228,7 @@ static unsigned long find_free_range(struct commonio_db *db,
unsigned long low, high;
/* When given invalid parameters fail */
if ((count == 0) || (max <= min))
if ((count == 0) || (max < min))
goto fail;
/* Sort by range then by owner */
@@ -246,7 +246,7 @@ static unsigned long find_free_range(struct commonio_db *db,
high = max;
/* Is the hole before this range large enough? */
if ((high > low) && (((high - low) + 1) >= count))
if ((high > low) && ((high - low) >= count))
return low;
/* Compute the low end of the next hole */