diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-02-19 14:49:38 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2016-02-19 14:49:38 +0100 |
commit | 6793dd51d8e7d4f3408c183c6f7dc86acd7f1330 (patch) | |
tree | 7d8f6b314549b47a510f3cfb387743f8fd4e7001 /posix/spawn_faction_addopen.c | |
parent | ff889b196575c2fbf6aa7130abb1ec862714ea4e (diff) | |
download | glibc-6793dd51d8e7d4f3408c183c6f7dc86acd7f1330.tar.gz glibc-6793dd51d8e7d4f3408c183c6f7dc86acd7f1330.tar.xz glibc-6793dd51d8e7d4f3408c183c6f7dc86acd7f1330.zip |
Improve file descriptor checks for posix_spawn actions [BZ #19505]
Diffstat (limited to 'posix/spawn_faction_addopen.c')
-rw-r--r-- | posix/spawn_faction_addopen.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/posix/spawn_faction_addopen.c b/posix/spawn_faction_addopen.c index 36cde06fb2..4f37d0b847 100644 --- a/posix/spawn_faction_addopen.c +++ b/posix/spawn_faction_addopen.c @@ -16,7 +16,6 @@ <http://www.gnu.org/licenses/>. */ #include <errno.h> -#include <spawn.h> #include <unistd.h> #include <stdlib.h> #include <string.h> @@ -30,11 +29,9 @@ posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *file_actions, int fd, const char *path, int oflag, mode_t mode) { - 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; char *path_copy = strdup (path); |