diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-10-31 21:34:01 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-10-31 21:34:01 +0000 |
commit | c02fa54041a68c12107ec577770ff81329af3bef (patch) | |
tree | ac6d3ee86cd046eca0c09c2de43695b5f3116d69 /sysdeps/unix/sysv/linux/ulimit.c | |
parent | 242bfefc41f4cc06dcff88c5bd143cc43719a73a (diff) | |
download | glibc-c02fa54041a68c12107ec577770ff81329af3bef.tar glibc-c02fa54041a68c12107ec577770ff81329af3bef.tar.gz glibc-c02fa54041a68c12107ec577770ff81329af3bef.tar.bz2 glibc-c02fa54041a68c12107ec577770ff81329af3bef.zip |
Updated to fedora-glibc-20081031T2102cvs/fedora-glibc-2_8_90-16
Diffstat (limited to 'sysdeps/unix/sysv/linux/ulimit.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/ulimit.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c index 9c309c371d..0b87599fea 100644 --- a/sysdeps/unix/sysv/linux/ulimit.c +++ b/sysdeps/unix/sysv/linux/ulimit.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,92,1994-1998,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,1994-1998,2000,2001,2008 + 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 @@ -47,26 +48,32 @@ __ulimit (int cmd, ...) /* Get limit on file size. */ if (__getrlimit (RLIMIT_FSIZE, &limit) == 0) /* Convert from bytes to 512 byte units. */ - result = limit.rlim_cur / 512; + result = (limit.rlim_cur == RLIM_INFINITY + ? LONG_MAX : limit.rlim_cur / 512); break; case UL_SETFSIZE: /* Set limit on file size. */ { long int newlimit = va_arg (va, long int); + long int newlen; if ((rlim_t) newlimit > RLIM_INFINITY / 512) { limit.rlim_cur = RLIM_INFINITY; limit.rlim_max = RLIM_INFINITY; + newlen = LONG_MAX; } else { limit.rlim_cur = newlimit * 512; limit.rlim_max = newlimit * 512; + newlen = newlimit; } result = __setrlimit (RLIMIT_FSIZE, &limit); + if (result != -1) + result = newlen; } break; |