diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/ulimit.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/ulimit.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c index c2481f5c8a..9c309c371d 100644 --- a/sysdeps/unix/sysv/linux/ulimit.c +++ b/sysdeps/unix/sysv/linux/ulimit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,94,95,96,97,98,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,1994-1998,2000,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 @@ -55,8 +55,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); } |