summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>1999-05-27 08:26:28 -0400
committerJarkko Hietaniemi <jhi@iki.fi>1999-05-27 16:57:19 +0000
commitd2201af29f5816f4d8147ff7af9b9a71b084ce41 (patch)
treec21f9da1c1f3aa7a97178942592c94e7e8eadb26 /util.c
parentce72088916dcda8278192dacefb0dcaf01be131c (diff)
downloadperl-d2201af29f5816f4d8147ff7af9b9a71b084ce41.tar.gz
Re: 5.005_57 NOT OK on SunOS 4.1.3
To: Perl Porters <perl5-porters@perl.org> Message-Id: <Pine.GSU.4.05.9905271120230.22115-100000@newton.phys> p4raw-id: //depot/cfgperl@3488
Diffstat (limited to 'util.c')
-rw-r--r--util.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/util.c b/util.c
index 82f6ea69f1..5615d472a3 100644
--- a/util.c
+++ b/util.c
@@ -3333,25 +3333,32 @@ my_fflush_all(void)
#else
long open_max = -1;
# if defined(FFLUSH_ALL) && defined(HAS_STDIO_STREAM_ARRAY)
+# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
+ open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
+# else
# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
open_max = sysconf(_SC_OPEN_MAX);
# else
# ifdef FOPEN_MAX
-# open_max = FOPEN_MAX;
+ open_max = FOPEN_MAX;
# else
# ifdef OPEN_MAX
-# open_max = OPEN_MAX;
+ open_max = OPEN_MAX;
# else
# ifdef _NFILE
-# open_max = _NFILE;
+ open_max = _NFILE;
# endif
# endif
# endif
# endif
+# endif
if (open_max > 0) {
long i;
for (i = 0; i < open_max; i++)
- PerlIO_flush(&STDIO_STREAM_ARRAY[i]);
+ if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
+ STDIO_STREAM_ARRAY[i]._file < open_max &&
+ STDIO_STREAM_ARRAY[i]._flag)
+ PerlIO_flush(&STDIO_STREAM_ARRAY[i]);
return 0;
}
# endif