This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/19505] New: Unwanted validity of the file descriptor in posix_spawn_file_actions_add{open,close,dup2} with unlimited file descriptor
- From: "obache at wizdas dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 21 Jan 2016 08:20:36 +0000
- Subject: [Bug libc/19505] New: Unwanted validity of the file descriptor in posix_spawn_file_actions_add{open,close,dup2} with unlimited file descriptor
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=19505
Bug ID: 19505
Summary: Unwanted validity of the file descriptor in
posix_spawn_file_actions_add{open,close,dup2} with
unlimited file descriptor
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: obache at wizdas dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
In functions "posix_spawn_file_actions_add{open,close,dup2}" implemented in
posix/spawn_function_add{open,close,dup2}.c, following checks exist:
int maxfd = __sysconf (_SC_OPEN_MAX);
if (fd < 0 || fd >= maxfd)
return EBADF;
But generally, "sysconf" will return "-1" if specified resource is unlimited.
So with unlimited file descriptor number situation, such functions always rise
EBADF even if passed "fd" is valid.
I can confirm it on GNU/Hurd with following, set it as maximum allowed value.
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) != -1 &&
rl.rlim_cur != rl.rlim_max) {
rl.rlim_cur = rl.rlim_max;
(void)setrlimit(RLIMIT_NOFILE, &rl);
}
--
You are receiving this mail because:
You are on the CC list for the bug.