1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
* sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Don't modify
	the rlimits structure passed in.

1999-11-19  Andreas Jaeger  <aj@suse.de>

	* include/sys/resource.h (__setrlimit): Add prototype.

1999-11-19  Ulrich Drepper  <drepper@cygnus.com>
This commit is contained in:
Ulrich Drepper
1999-11-20 05:08:30 +00:00
parent 228589d285
commit 602b6b0fe4
3 changed files with 23 additions and 7 deletions

View File

@ -41,6 +41,10 @@ __setrlimit (resource, rlimits)
enum __rlimit_resource resource;
const struct rlimit *rlimits;
{
#ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL
struct rlimit rlimits_small;
#endif
#ifdef __NR_ugetrlimit
if (! no_new_getrlimit)
{
@ -62,13 +66,13 @@ __setrlimit (resource, rlimits)
#ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL
/* We might have to correct the limits values. Since the old values
were signed the new values are too large. */
rlimits->rlim_cur = MIN ((unsigned long int) rlimits->rlim_cur,
RLIM_INFINITY >> 2);
rlimits->rlim_max = MIN ((unsigned long int) rlimits->rlim_max,
RLIM_INFINITY >> 2);
rlimits_small.rlim_cur = MIN ((unsigned long int) rlimits->rlim_cur,
RLIM_INFINITY >> 2);
rlimits_small.rlim_max = MIN ((unsigned long int) rlimits->rlim_max,
RLIM_INFINITY >> 2);
/* Fall back on the old system call. */
return INLINE_SYSCALL (setrlimit, 2, resource, rlimits);
return INLINE_SYSCALL (setrlimit, 2, resource, &rlimits_small);
#endif
}
weak_alias (__setrlimit, setrlimit)