Change 31360 by [EMAIL PROTECTED] on 2007/06/08 15:28:29
Make pipe shutdown on VMS care about whether PerlIO has already
shut down.
Affected files ...
... //depot/perl/vms/vms.c#198 edit
Differences ...
==== //depot/perl/vms/vms.c#198 (text) ====
Index: perl/vms/vms.c
--- perl/vms/vms.c#197~31331~ 2007-06-03 15:26:20.000000000 -0700
+++ perl/vms/vms.c 2007-06-08 08:28:29.000000000 -0700
@@ -2823,14 +2823,20 @@
unsigned long int retsts = SS$_NORMAL, abort = SS$_TIMEOUT;
int sts, did_stuff, need_eof, j;
- /*
- flush any pending i/o
+ /*
+ * Flush any pending i/o, but since we are in process run-down, be
+ * careful about referencing PerlIO structures that may already have
+ * been deallocated. We may not even have an interpreter anymore.
*/
info = open_pipes;
while (info) {
if (info->fp) {
- if (!info->useFILE)
- PerlIO_flush(info->fp); /* first, flush data */
+ if (!info->useFILE
+#if defined(USE_ITHREADS)
+ && my_perl
+#endif
+ && PL_perlio_fd_refcnt)
+ PerlIO_flush(info->fp);
else
fflush((FILE *)info->fp);
}
@@ -4377,8 +4383,12 @@
* the first EOF closing the pipe (and DASSGN'ing the channel)...
*/
if (info->fp) {
- if (!info->useFILE)
- PerlIO_flush(info->fp); /* first, flush data */
+ if (!info->useFILE
+#if defined(USE_ITHREADS)
+ && my_perl
+#endif
+ && PL_perlio_fd_refcnt)
+ PerlIO_flush(info->fp);
else
fflush((FILE *)info->fp);
}
@@ -4400,7 +4410,11 @@
0, 0, 0, 0, 0, 0));
_ckvmssts(sys$setast(1));
if (info->fp) {
- if (!info->useFILE)
+ if (!info->useFILE
+#if defined(USE_ITHREADS)
+ && my_perl
+#endif
+ && PL_perlio_fd_refcnt)
PerlIO_close(info->fp);
else
fclose((FILE *)info->fp);
End of Patch.