4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 04:49:25 +08:00

Cygwin: setrlimit: Add a permission check

If the incoming soft limit is less restrictive than the current
hard limit, bail out with EPERM.  Given the previous sanity check,
this implies trying to raise the hard limit.  While, theoretically,
this should be allowed for privileged processes, Windows has no
matching concept in terms of job limits

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-11-30 12:48:34 +01:00
parent d64cd470ae
commit 670beaed02

View File

@ -261,6 +261,12 @@ setrlimit (int resource, const struct rlimit *rlp)
__leave;
}
if (rlp->rlim_cur > oldlimits.rlim_max)
{
set_errno (EPERM);
__leave;
}
switch (resource)
{
case RLIMIT_AS: