summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-12-29 17:48:04 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-29 17:48:04 +0000
commitd082dcd6e9724167401d515fda11cac153061911 (patch)
treef5b504acff0bfdbbe10523a37f8f03fb54b9d96a /doio.c
parentc7206c54089b550f8b7c01366011a58bd74a9703 (diff)
downloadperl-d082dcd6e9724167401d515fda11cac153061911.tar.gz
Further VMS piping fixes from Charles Lane:
In summary, error messages produced when a subprocess terminated abnormally were being sent not just to the parent process, but to grandparents, because of default values for error output that were not completely overridden when the subprocess was started. This patch fixes this behavior by defining user-mode (i.e., temporary for the duration of the program) logical names for SYS$OUTPUT and SYS$ERROR when they are (re)opened inside Perl. And a bunch of other changes to make it so that the user-mode logicals are the ones that control where Perl's error messages go if it terminates abnormally. I also added some gratuitous fixes to the indentation of braces in the piping code. It just looked ugly, before. p4raw-id: //depot/perl@8257
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/doio.c b/doio.c
index 1ac381b896..94a4329e1e 100644
--- a/doio.c
+++ b/doio.c
@@ -476,6 +476,15 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
SV *sv;
PerlLIO_dup2(PerlIO_fileno(fp), fd);
+#ifdef VMS
+ if (fd != PerlIO_fileno(PerlIO_stdin())) {
+ char newname[FILENAME_MAX+1];
+ if (fgetname(fp, newname)) {
+ if (fd == PerlIO_fileno(PerlIO_stdout())) Perl_vmssetuserlnm("SYS$OUTPUT", newname);
+ if (fd == PerlIO_fileno(PerlIO_stderr())) Perl_vmssetuserlnm("SYS$ERROR", newname);
+ }
+ }
+#endif
LOCK_FDPID_MUTEX;
sv = *av_fetch(PL_fdpid,PerlIO_fileno(fp),TRUE);
(void)SvUPGRADE(sv, SVt_IV);