aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/sched.cc
diff options
context:
space:
mode:
authorChristian Franke <christian.franke@t-online.de>2024-11-27 10:26:38 +0100
committerCorinna Vinschen <corinna@vinschen.de>2024-11-27 16:38:39 +0100
commit153b51ee08efc39068ed2cc897855ea4aba5d96e (patch)
treec13b73ba27138a6a3ed99d78b97ea08f9db4cefe /winsup/cygwin/sched.cc
parent46d1e63c76c032d0a8ad4f30f75be7347e24cbb0 (diff)
downloadnewlib-153b51ee08efc39068ed2cc897855ea4aba5d96e.zip
newlib-153b51ee08efc39068ed2cc897855ea4aba5d96e.tar.gz
newlib-153b51ee08efc39068ed2cc897855ea4aba5d96e.tar.bz2
Cygwin: setpriority, sched_setparam: fail if Windows sets a lower priority
Windows silently sets a lower priority than requested if the new priority requires administrator privileges. Revert to previous priority and fail with EACCES or EPERM in this case. Signed-off-by: Christian Franke <christian.franke@t-online.de>
Diffstat (limited to 'winsup/cygwin/sched.cc')
-rw-r--r--winsup/cygwin/sched.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc
index 22ff0c8..1874160 100644
--- a/winsup/cygwin/sched.cc
+++ b/winsup/cygwin/sched.cc
@@ -266,7 +266,7 @@ sched_setparam (pid_t pid, const struct sched_param *param)
set_errno (ESRCH);
return -1;
}
- if (!SetPriorityClass (process, pclass))
+ if (!set_and_check_winprio (process, pclass))
{
CloseHandle (process);
set_errno (EPERM);