aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-09-25 07:00:26 +0000
committerUlrich Drepper <drepper@redhat.com>2001-09-25 07:00:26 +0000
commita4fe3ea6085e56d3914d0866568c28ac8d10b961 (patch)
treea7fbf5b15a644ccec554038fde3a92a456535c56
parent84e4ff7b49dd13a023b4094d50c843ac16f4ab65 (diff)
downloadglibc-a4fe3ea6085e56d3914d0866568c28ac8d10b961.tar
glibc-a4fe3ea6085e56d3914d0866568c28ac8d10b961.tar.gz
glibc-a4fe3ea6085e56d3914d0866568c28ac8d10b961.tar.bz2
glibc-a4fe3ea6085e56d3914d0866568c28ac8d10b961.zip
Update.
* sysdeps/unix/bsd/ulimit.c (ulimit): Handle overflow in UL_SETFSIZE computations better.
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/unix/bsd/ulimit.c14
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e7de6f013f..1e6faaf408 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2001-09-24 Ulrich Drepper <drepper@redhat.com>
+ * sysdeps/unix/bsd/ulimit.c (ulimit): Handle overflow in
+ UL_SETFSIZE computations better.
+
* rt/Makefile: Remove use of filter for librt again.
* sysdeps/unix/sysv/linux/ulimit.c (__ulimit): Handle overflow in
diff --git a/sysdeps/unix/bsd/ulimit.c b/sysdeps/unix/bsd/ulimit.c
index ed9695b845..91d77e926a 100644
--- a/sysdeps/unix/bsd/ulimit.c
+++ b/sysdeps/unix/bsd/ulimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 96, 97, 98, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -60,8 +60,16 @@ ulimit (int cmd, ...)
{
long int newlimit = va_arg (va, long int);
- limit.rlim_cur = newlimit * 512;
- limit.rlim_max = newlimit * 512;
+ if ((rlim_t) newlimit > RLIM_INFINITY / 512)
+ {
+ limit.rlim_cur = RLIM_INFINITY;
+ limit.rlim_max = RLIM_INFINITY;
+ }
+ else
+ {
+ limit.rlim_cur = newlimit * 512;
+ limit.rlim_max = newlimit * 512;
+ }
result = setrlimit (RLIMIT_FSIZE, &limit);
}