From aeb07cfc3c2688a6b4be2fd600a893776f1c2893 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 11 May 1999 20:31:54 +0000 Subject: [PATCH] close all open files when spawning the repeater --- src/ca/posix_depen.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ca/posix_depen.c b/src/ca/posix_depen.c index 19336763b..8591f566c 100644 --- a/src/ca/posix_depen.c +++ b/src/ca/posix_depen.c @@ -29,6 +29,9 @@ * Modification Log: * ----------------- * $Log$ + * Revision 1.27 1999/05/11 20:09:58 jhill + * close all open files when spawning the repeater + * * Revision 1.26 1999/05/11 19:42:44 jhill * close all open files when spawning the repeater * @@ -222,7 +225,7 @@ int max_unix_fd( ) static const int bestGuess = 1024; # if defined(OPEN_MAX) - max = OPEN_MAX; + max = OPEN_MAX; /* posix */ # elif defined(_SC_OPEN_MAX) max = sysconf (_SC_OPEN_MAX); if (max<0) { @@ -243,7 +246,8 @@ void ca_spawn_repeater() { int status; char *pImageName; - int fd; + int fd; + int maxfd; /* * create a duplicate process @@ -266,7 +270,8 @@ void ca_spawn_repeater() * close all open files except for STDIO so they will not * be inherited by the repeater task */ - for (fd = 0; fd<=OPEN_MAX; fd++) { + maxfd = max_unix_fd (); + for (fd = 0; fd<=maxfd; fd++) { if (fd==STDIN_FILENO) continue; if (fd==STDOUT_FILENO) continue; if (fd==STDERR_FILENO) continue;