about summary refs log tree commit diff
path: root/sysdeps/generic/setrlimit64.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/setrlimit64.c')
-rw-r--r--sysdeps/generic/setrlimit64.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sysdeps/generic/setrlimit64.c b/sysdeps/generic/setrlimit64.c
index 3d1a12279f..97329c58d8 100644
--- a/sysdeps/generic/setrlimit64.c
+++ b/sysdeps/generic/setrlimit64.c
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Set the soft and hard limits for RESOURCE to *RLIMITS.
    Only the super-user can increase hard limits.
@@ -27,8 +28,18 @@ setrlimit64 (resource, rlimits)
      enum __rlimit_resource resource;
      struct rlimit64 *rlimits;
 {
-  __set_errno (ENOSYS);
-  return -1;
+  struct rlimit rlimits32;
+
+  if (rlimits->rlim_cur >= RLIM_INFINITY)
+    rlimits32.rlim_cur = RLIM_INFINITY;
+  else
+    rlimits32.rlim_cur = rlimits->rlim_cur;
+  if (rlimits->rlim_max >= RLIM_INFINITY)
+    rlimits32.rlim_max = RLIM_INFINITY;
+  else
+    rlimits32.rlim_max = rlimits->rlim_max;
+
+  return setrlimit (resource, &rlimits32);
 }
 
 stub_warning (setrlimit64)