--- resource.cc.orig Fri Jan 5 15:11:40 2001 +++ resource.cc Fri Jan 5 15:15:14 2001 @@ -141,6 +141,19 @@ if (!rlp || !VirtualQuery (rlp, &m, sizeof (m)) || (m.State != MEM_COMMIT)) return EFAULT; + 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; + + if (oldlimits.rlim_cur == rlp->rlim_cur && + oldlimits.rlim_max == rlp->rlim_max) + // No change in resource requirements, succeed immediately + return 0; + switch (resource) { case RLIMIT_CORE: