Cygwin: setpriority, sched_setparam: add missing process access right
set_and_check_winprio() also requires PROCESS_QUERY_LIMITED_INFORMATION.
Also add an early check for this access right to set_and_check_winprio().
Fixes: 153b51ee08
("Cygwin: setpriority, sched_setparam: fail if Windows sets a lower priority")
Signed-off-by: Christian Franke <christian.franke@t-online.de>
This commit is contained in:
parent
b99742712e
commit
a82bf55908
|
@ -190,6 +190,8 @@ bool
|
|||
set_and_check_winprio (HANDLE proc, DWORD prio)
|
||||
{
|
||||
DWORD prev_prio = GetPriorityClass (proc);
|
||||
if (!prev_prio)
|
||||
return false;
|
||||
if (prev_prio == prio)
|
||||
return true;
|
||||
|
||||
|
|
|
@ -260,7 +260,9 @@ sched_setparam (pid_t pid, const struct sched_param *param)
|
|||
set_errno (ESRCH);
|
||||
return -1;
|
||||
}
|
||||
process = OpenProcess (PROCESS_SET_INFORMATION, FALSE, p->dwProcessId);
|
||||
process = OpenProcess (PROCESS_SET_INFORMATION |
|
||||
PROCESS_QUERY_LIMITED_INFORMATION,
|
||||
FALSE, p->dwProcessId);
|
||||
if (!process)
|
||||
{
|
||||
set_errno (ESRCH);
|
||||
|
|
|
@ -3869,8 +3869,9 @@ setpriority (int which, id_t who, int value)
|
|||
continue;
|
||||
break;
|
||||
}
|
||||
HANDLE proc_h = OpenProcess (PROCESS_SET_INFORMATION, FALSE,
|
||||
p->dwProcessId);
|
||||
HANDLE proc_h = OpenProcess (PROCESS_SET_INFORMATION |
|
||||
PROCESS_QUERY_LIMITED_INFORMATION,
|
||||
FALSE, p->dwProcessId);
|
||||
if (!proc_h)
|
||||
error = EPERM;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue