From: Ulrich Drepper Date: Sat, 20 Nov 1999 05:10:14 +0000 (+0000) Subject: (__setrlimit): Don't modify the rlimits structure passed in. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c831d399afb01adc17027ecf73fdd363104ca6aa;p=thirdparty%2Fglibc.git (__setrlimit): Don't modify the rlimits structure passed in. --- diff --git a/sysdeps/unix/sysv/linux/setrlimit.c b/sysdeps/unix/sysv/linux/setrlimit.c index 422aa303a7c..f0c3e41e07d 100644 --- a/sysdeps/unix/sysv/linux/setrlimit.c +++ b/sysdeps/unix/sysv/linux/setrlimit.c @@ -39,6 +39,8 @@ __setrlimit (resource, rlimits) enum __rlimit_resource resource; const struct rlimit *rlimits; { + struct rlimit rlimits_small; + #ifdef __NR_ugetrlimit if (! no_new_getrlimit) { @@ -55,10 +57,10 @@ __setrlimit (resource, rlimits) /* 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);