summaryrefslogtreecommitdiff
path: root/lib/texpect
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2020-01-15 12:37:22 +0100
committerJeremy Allison <jra@samba.org>2020-01-15 21:25:34 +0000
commit4371982619d4fb0b784813950055a0f19e0e8667 (patch)
tree0b65f747c27989b2c005a8202170e9bf56c32649 /lib/texpect
parent2198da1b9bf79e86112aeeb8e9653f6a82f69e8d (diff)
downloadsamba-4371982619d4fb0b784813950055a0f19e0e8667.tar.gz
texpect: Use lib/replace's closefrom()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/texpect')
-rw-r--r--lib/texpect/texpect.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c
index 32b2fded410..797f0a024b4 100644
--- a/lib/texpect/texpect.c
+++ b/lib/texpect/texpect.c
@@ -235,23 +235,6 @@ static void parse_configuration(const char *fn)
fclose(cmd);
}
-/* A wrapper to close als file descriptors above the given fd */
-static int sys_closefrom(int fd)
-{
- int num = getdtablesize();
-
- if (num < 0) {
- num = 1024;
- }
-
- for (; fd <= num; fd++) {
- close(fd);
- }
-
- return 0;
-}
-
-
/*
*
*/
@@ -463,7 +446,7 @@ int main(int argc, const char **argv)
dup2(slave, STDOUT_FILENO);
dup2(slave, STDERR_FILENO);
- sys_closefrom(STDERR_FILENO + 1);
+ closefrom(STDERR_FILENO + 1);
/* texpect <expect_instructions> <progname> [<args>] */
execvp(program, program_args);