kernel/sem: Properly handle create_sem being called with a negative count.

It doesn't make much sense to do this, and the Be Book specifies that
doing so will return an error. A user on the mailing list tested
against BeOS and confirmed that it does reject this, so we should too.
This commit is contained in:
Augustin Cavalier
2025-02-07 13:06:43 -05:00
parent 1e56d889ee
commit 7a0fdd19a0
+2
View File
@@ -468,6 +468,8 @@ haiku_sem_init(kernel_args *args)
sem_id
create_sem_etc(int32 count, const char* name, team_id owner)
{
if (count < 0)
return B_BAD_VALUE;
if (!sSemsActive || sUsedSems == sMaxSems)
return B_NO_MORE_SEMS;