about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/setrlimit.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-11-20 05:08:30 +0000
committerUlrich Drepper <drepper@redhat.com>1999-11-20 05:08:30 +0000
commit602b6b0fe4976bbb17347fda33e6feac88b91906 (patch)
tree1f39417bb4058007c0c358de6ebb3334895ec45f /sysdeps/unix/sysv/linux/setrlimit.c
parent228589d285c9d65e361d52b8de99e81dc7e6cee0 (diff)
downloadglibc-602b6b0fe4976bbb17347fda33e6feac88b91906.tar.gz
glibc-602b6b0fe4976bbb17347fda33e6feac88b91906.tar.xz
glibc-602b6b0fe4976bbb17347fda33e6feac88b91906.zip
Update.
	* 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>
Diffstat (limited to 'sysdeps/unix/sysv/linux/setrlimit.c')
-rw-r--r--sysdeps/unix/sysv/linux/setrlimit.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/setrlimit.c b/sysdeps/unix/sysv/linux/setrlimit.c
index 9df977447a..43bfdbbbc4 100644
--- a/sysdeps/unix/sysv/linux/setrlimit.c
+++ b/sysdeps/unix/sysv/linux/setrlimit.c
@@ -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)