summaryrefslogtreecommitdiff
path: root/vms
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2007-06-08 15:28:29 +0000
committerCraig A. Berry <craigberry@mac.com>2007-06-08 15:28:29 +0000
commit5ce486e0e787cc41a2d5023371386b518e92c1c2 (patch)
tree9590f3e36b6b5e6083460551d80bc169a2304c5a /vms
parent04c24be184a2592c0ce227fc6f74e37383b36818 (diff)
downloadperl-5ce486e0e787cc41a2d5023371386b518e92c1c2.tar.gz
Make pipe shutdown on VMS care about whether PerlIO has already
shut down. p4raw-id: //depot/perl@31360
Diffstat (limited to 'vms')
-rw-r--r--vms/vms.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/vms/vms.c b/vms/vms.c
index ec8ecfdbc2..f9aa9a3e73 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -2823,14 +2823,20 @@ pipe_exit_routine(pTHX)
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 @@ I32 Perl_my_pclose(pTHX_ PerlIO *fp)
* 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 @@ I32 Perl_my_pclose(pTHX_ PerlIO *fp)
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);