summaryrefslogtreecommitdiff
path: root/posix/spawn_faction_addclose.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-02-19 14:49:38 +0100
committerFlorian Weimer <fweimer@redhat.com>2016-02-19 14:49:38 +0100
commit6793dd51d8e7d4f3408c183c6f7dc86acd7f1330 (patch)
tree7d8f6b314549b47a510f3cfb387743f8fd4e7001 /posix/spawn_faction_addclose.c
parentff889b196575c2fbf6aa7130abb1ec862714ea4e (diff)
Improve file descriptor checks for posix_spawn actions [BZ #19505]
Diffstat (limited to 'posix/spawn_faction_addclose.c')
-rw-r--r--posix/spawn_faction_addclose.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/posix/spawn_faction_addclose.c b/posix/spawn_faction_addclose.c
index 1a4a2f2457..946454e646 100644
--- a/posix/spawn_faction_addclose.c
+++ b/posix/spawn_faction_addclose.c
@@ -27,11 +27,9 @@ int
posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
int fd)
{
- int maxfd = __sysconf (_SC_OPEN_MAX);
struct __spawn_action *rec;
- /* Test for the validity of the file descriptor. */
- if (fd < 0 || fd >= maxfd)
+ if (!__spawn_valid_fd (fd))
return EBADF;
/* Allocate more memory if needed. */