diff options
| author | Corinna Vinschen <corinna@vinschen.de> | 2026-01-25 23:31:34 +0100 |
|---|---|---|
| committer | Corinna Vinschen <corinna@vinschen.de> | 2026-02-13 20:23:36 +0100 |
| commit | 6d049c54c3314da31d9ffac133a6a2f2dfecaac2 (patch) | |
| tree | 128296353b4750210a702a26286b2b34ba22de4b | |
| parent | a440f5edd8a06517996d2d2a2586982d51a2fa75 (diff) | |
| download | newlib-master.zip newlib-master.tar.gz newlib-master.tar.bz2 | |
Cygwin: setrlimit: fix comments in terms of input checkingHEADgithub/mastergithub/mainmastermain
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
| -rw-r--r-- | winsup/cygwin/resource.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index 9dfe36b..1e9e918 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -296,24 +296,25 @@ setrlimit (int resource, const struct rlimit *rlp) { struct rlimit oldlimits; - /* Check if the request is to actually change the resource settings. - If it does not result in a change, take no action and do not fail. */ if (getrlimit (resource, &oldlimits) < 0) return -1; __try { + /* Check if the request is to actually change the resource settings. + If it does not result in a change, take no action and do not fail. */ if (oldlimits.rlim_cur == rlp->rlim_cur && oldlimits.rlim_max == rlp->rlim_max) - /* No change in resource requirements, succeed immediately */ return 0; + /* soft limit > hard limit ? EINVAL */ if (rlp->rlim_cur > rlp->rlim_max) { set_errno (EINVAL); __leave; } + /* hard limit > current hard limit ? EPERM if not admin */ if (rlp->rlim_max > oldlimits.rlim_max && !check_token_membership (well_known_admins_sid)) { |
