Fix boundary conditions.

* lib/subordinateio.c (find_free_range): max is allowed for new
	ranges.
This commit is contained in:
Nicolas François 2013-08-15 17:03:18 +02:00
parent 7d5732cb49
commit 5917347c6f
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2013-08-15 Nicolas François <nicolas.francois@centraliens.net>
* lib/subordinateio.c (find_free_range): max is allowed for new
ranges.
2013-08-15 Nicolas François <nicolas.francois@centraliens.net> 2013-08-15 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/find_new_sub_gids.c: Remove dead code. * libmisc/find_new_sub_gids.c: Remove dead code.

View File

@ -225,8 +225,11 @@ static unsigned long find_free_range(struct commonio_db *db,
/* Find the top end of the hole before this range */ /* Find the top end of the hole before this range */
high = first; high = first;
if (high > max)
high = max; /* Don't allocate IDs after max (included) */
if (high > max + 1) {
high = max + 1;
}
/* Is the hole before this range large enough? */ /* Is the hole before this range large enough? */
if ((high > low) && ((high - low) >= count)) if ((high > low) && ((high - low) >= count))