about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--include/sys/resource.h7
-rw-r--r--sysdeps/unix/sysv/linux/setrlimit.c14
3 files changed, 23 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 10244c7145..08a8ea9ed9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 1999-11-19  Ulrich Drepper  <drepper@cygnus.com>
 
+	* 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>
+
 	* elf/dl-load.c (_dl_init_paths): Allocate correct number of
 	entries for rtld_search_dirs[0].
 	Patch by David Mosberger <davidm@hpl.hp.com>.
diff --git a/include/sys/resource.h b/include/sys/resource.h
index e234cc0426..8877b35f2a 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -3,6 +3,9 @@
 
 /* Now define the internal interfaces.  */
 extern int __getrlimit (enum __rlimit_resource __resource,
-			struct rlimit *__rlimits) __THROW;
-extern int __getrusage (enum __rusage_who __who, struct rusage *__usage) __THROW;
+			struct rlimit *__rlimits);
+extern int __getrusage (enum __rusage_who __who, struct rusage *__usage);
+
+extern int __setrlimit (enum __rlimit_resource __resource,
+			const struct rlimit *__rlimits);
 #endif
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)