summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 9a783d524..e7e4c59b6 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -594,16 +594,17 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) {
594 } 594 }
595 595
596 const auto* const current_process = Core::CurrentProcess(); 596 const auto* const current_process = Core::CurrentProcess();
597 SharedPtr<Thread> thread = current_process->GetHandleTable().Get<Thread>(handle);
598 if (!thread) {
599 return ERR_INVALID_HANDLE;
600 }
601 597
602 // Note: The kernel uses the current process's resource limit instead of 598 // Note: The kernel uses the current process's resource limit instead of
603 // the one from the thread owner's resource limit. 599 // the one from the thread owner's resource limit.
604 const ResourceLimit& resource_limit = current_process->GetResourceLimit(); 600 const ResourceLimit& resource_limit = current_process->GetResourceLimit();
605 if (resource_limit.GetMaxResourceValue(ResourceType::Priority) > priority) { 601 if (resource_limit.GetMaxResourceValue(ResourceType::Priority) > priority) {
606 return ERR_NOT_AUTHORIZED; 602 return ERR_INVALID_THREAD_PRIORITY;
603 }
604
605 SharedPtr<Thread> thread = current_process->GetHandleTable().Get<Thread>(handle);
606 if (!thread) {
607 return ERR_INVALID_HANDLE;
607 } 608 }
608 609
609 thread->SetPriority(priority); 610 thread->SetPriority(priority);