1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-15 15:06:42 +00:00

Insert missing increment of (i) when walking the temporary semaphore

vector during fork.

Fix assertion which contained an off-by-one error.

Submitted by:	Antoine Brodin < antoine dot brodin at laposte dot net >
This commit is contained in:
Robert Watson 2005-02-25 21:00:14 +00:00
parent d40b07dfe4
commit fa6fc5b819
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142507

View File

@ -910,6 +910,7 @@ sem_forkhook(arg, p1, p2, flags)
if (ku->ku_pid == p1->p_pid) {
sem_ref(ks);
sem_array[i] = ks;
i++;
break;
}
}
@ -919,13 +920,13 @@ sem_forkhook(arg, p1, p2, flags)
if (ku->ku_pid == p1->p_pid) {
sem_ref(ks);
sem_array[i] = ks;
i++;
break;
}
}
}
mtx_unlock(&sem_lock);
KASSERT(i + 1 == count, ("sem_forkhook: i != count (%d, %d)", i,
count));
KASSERT(i == count, ("sem_forkhook: i != count (%d, %d)", i, count));
/*
* Now cause p2 to enter each of the referenced semaphores, then
* release our temporary reference. This is pretty inefficient.