]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(__setrlimit): Don't modify the rlimits structure passed in.
authorUlrich Drepper <drepper@redhat.com>
Sat, 20 Nov 1999 05:10:14 +0000 (05:10 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 20 Nov 1999 05:10:14 +0000 (05:10 +0000)
sysdeps/unix/sysv/linux/setrlimit.c

index 422aa303a7cac7160283b8e64fb1cae4c3f48c43..f0c3e41e07db9c6e0d0e58be9acc6294a3a1e235 100644 (file)
@@ -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);