summaryrefslogtreecommitdiff
path: root/lib/spawn_faction_addclose.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-09-30 18:22:54 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-09-30 18:22:54 +0400
commit08bc9e01c274a01d107b348f921e1c74dd04bd3a (patch)
tree25348bff03c29d9dd6c6dd96bf82c7c9f9265ccf /lib/spawn_faction_addclose.c
parentb9c7373f203ab77c58cb6b131f8b58236ea337a2 (diff)
parentc18578632fd3c9e513e613a86ba2b7c4ebee6c45 (diff)
downloadcoreutils-08bc9e01c274a01d107b348f921e1c74dd04bd3a.tar.gz
Merge tag 'upstream/8.23'
Upstream version 8.23
Diffstat (limited to 'lib/spawn_faction_addclose.c')
-rw-r--r--lib/spawn_faction_addclose.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/lib/spawn_faction_addclose.c b/lib/spawn_faction_addclose.c
deleted file mode 100644
index 86a9aba2..00000000
--- a/lib/spawn_faction_addclose.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <errno.h>
-#include <unistd.h>
-
-#if !_LIBC
-# define __sysconf(open_max) getdtablesize ()
-#endif
-
-#if !HAVE_WORKING_POSIX_SPAWN
-# include "spawn_int.h"
-#endif
-
-/* Add an action to FILE-ACTIONS which tells the implementation to call
- 'close' for the given file descriptor during the 'spawn' call. */
-int
-posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
- int fd)
-#undef posix_spawn_file_actions_addclose
-{
- int maxfd = __sysconf (_SC_OPEN_MAX);
-
- /* Test for the validity of the file descriptor. */
- if (fd < 0 || fd >= maxfd)
- return EBADF;
-
-#if HAVE_WORKING_POSIX_SPAWN
- return posix_spawn_file_actions_addclose (file_actions, fd);
-#else
- /* Allocate more memory if needed. */
- if (file_actions->_used == file_actions->_allocated
- && __posix_spawn_file_actions_realloc (file_actions) != 0)
- /* This can only mean we ran out of memory. */
- return ENOMEM;
-
- {
- struct __spawn_action *rec;
-
- /* Add the new value. */
- rec = &file_actions->_actions[file_actions->_used];
- rec->tag = spawn_do_close;
- rec->action.open_action.fd = fd;
-
- /* Account for the new entry. */
- ++file_actions->_used;
-
- return 0;
- }
-#endif
-}