Match dup2 and fcntl error values to POSIX.

* dtable.h (OPEN_MAX_MAX): New macro.
* resource.cc (getrlimit) [RLIMIT_NOFILE]: Use it.
* dtable.cc (dtable::extend): Likewise.
* fcntl.cc (fcntl64): Obey POSIX rule with too-large F_DUPFD.
* syscalls.cc (dup2): Likewise.
This commit is contained in:
Eric Blake
2009-09-22 04:09:03 +00:00
parent a7b24e14d7
commit 29bca9bb0c
6 changed files with 23 additions and 5 deletions

View File

@@ -143,7 +143,7 @@ getrlimit (int resource, struct rlimit *rlp)
rlp->rlim_cur = getdtablesize ();
if (rlp->rlim_cur < OPEN_MAX)
rlp->rlim_cur = OPEN_MAX;
rlp->rlim_max = 100 * NOFILE_INCR;
rlp->rlim_max = OPEN_MAX_MAX;
break;
case RLIMIT_CORE:
rlp->rlim_cur = rlim_core;