Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
	* sysdeps/unix/bsd/ulimit.c (ulimit): Handle overflow in
	UL_SETFSIZE computations better.
  • Loading branch information
Ulrich Drepper committed Sep 25, 2001
1 parent 84e4ff7 commit a4fe3ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 11 additions & 3 deletions sysdeps/unix/bsd/ulimit.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a4fe3ea

Please sign in to comment.