mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
* sysdeps/unix/bsd/ulimit.c (ulimit): Handle overflow in UL_SETFSIZE computations better.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user