mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
kernel:fix sys_osem_trywait merge issue
fix sys_osem_post on wrong descriptor
This commit is contained in:
parent
afde24fd91
commit
661a71885b
|
|
@ -609,7 +609,9 @@ orbis::SysResult orbis::sys_osem_trywait(Thread *thread, sint id, sint need) {
|
|||
return ErrorCode::BADF;
|
||||
}
|
||||
|
||||
if (need < 1 || need > sem->maxValue) {
|
||||
return ErrorCode::INVAL;
|
||||
}
|
||||
|
||||
std::lock_guard lock(sem->mtx);
|
||||
if (sem->isDeleted || sem->value < need)
|
||||
|
|
@ -620,8 +622,12 @@ orbis::SysResult orbis::sys_osem_trywait(Thread *thread, sint id, sint need) {
|
|||
orbis::SysResult orbis::sys_osem_post(Thread *thread, sint id, sint count) {
|
||||
ORBIS_LOG_TRACE(__FUNCTION__, thread, id, count);
|
||||
Ref<Semaphore> sem = thread->tproc->semMap.get(id);
|
||||
if (count < 1 || count > sem->maxValue - sem->value)
|
||||
if (sem == nullptr) {
|
||||
return ErrorCode::BADF;
|
||||
}
|
||||
if (count < 1 || count > sem->maxValue - sem->value) {
|
||||
return ErrorCode::INVAL;
|
||||
}
|
||||
|
||||
std::lock_guard lock(sem->mtx);
|
||||
if (sem->isDeleted)
|
||||
|
|
|
|||
Loading…
Reference in a new issue