Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 4892 - dup2(1, OPEN_MAX) return is not POSIX.1 conformant
Summary: dup2(1, OPEN_MAX) return is not POSIX.1 conformant
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 6.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-09-03 19:10 UTC by Jay Turner
Modified: 2015-01-07 23:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2000-04-22 06:09:02 UTC

Attachments (Terms of Use)

Description Glen Foster 1999-09-03 19:10:52 UTC
According to POSIX.1 (page 149,, lines 70-74), a
call to dup2(1, sysconf(_SC_OPEN_MAX)) should set errno to
EBADF, but instead (incorrectly) sets errno == EMFILE.

This is seen running the PCTS on a stock 6.0 Intel system.

Comment 1 Cristian Gafton 2000-01-04 22:25:59 UTC
Assigned to dledford

Comment 2 Cristian Gafton 2000-01-04 22:26:59 UTC
Assigned to dledford

Comment 3 Bill Nottingham 2000-02-05 23:31:59 UTC
Still exists in 2.2.15pre5.

Comment 4 Doug Ledford 2000-04-22 06:09:59 UTC
Last I knew, this is a backwards compatibility issue.  In order to keep older
binaries from breaking on new kernels that support thousands of open files in a
single application, the kernels have to *pretend* like OPEN_MAX is 1024, like it
used to be.  However, to those applications that know about it, they can call
setrlimit() to increase the number of files allowed.  As far as I know, the
result of this situation is that we have some differing error returns and this
is by design.  If that's wrong, then I'm sure Alan can correct it ;-)

Note You need to log in before you can comment on or make changes to this bug.