Fix #18711 and add test for it (and indeed tell on write
[p5sagit/p5-mst-13.2.git] / mg.c
diff --git a/mg.c b/mg.c
index 69bb521..bdf204b 100644 (file)
--- a/mg.c
+++ b/mg.c
 #  endif
 #endif
 
+#ifdef __hpux
+#  include <sys/pstat.h>
+#endif
+
 /* if you only have signal() and it resets on each signal, FAKE_PERSISTENT_SIGNAL_HANDLERS fixes */
 #if !defined(HAS_SIGACTION) && defined(VMS)
 #  define  FAKE_PERSISTENT_SIGNAL_HANDLERS
@@ -654,7 +658,9 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
 #endif
         }
         else if (strEQ(mg->mg_ptr, "\024AINT"))
-            sv_setiv(sv, PL_tainting);
+            sv_setiv(sv, PL_tainting
+                   ? (PL_taint_warn || PL_unsafe ? -1 : 1)
+                   : 0);
         break;
     case '\027':               /* ^W  & $^WARNING_BITS & ^WIDE_SYSTEM_CALLS */
        if (*(mg->mg_ptr+1) == '\0')
@@ -814,7 +820,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
        break;
     case '\\':
        if (PL_ors_sv)
-           sv_setpv(sv,SvPVX(PL_ors_sv));
+           sv_copypv(sv, PL_ors_sv);
        break;
     case '#':
        sv_setpv(sv,PL_ofmt);
@@ -2232,6 +2238,14 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
 #   endif
        }
 #endif
+#if defined(__hpux) && defined(PSTAT_SETCMD)
+       {
+            union pstun un;
+            s = SvPV(sv, len);
+            un.pst_command = s;
+            pstat(PSTAT_SETCMD, un, len, 0, 0);
+       }
+#endif
        if (!PL_origalen) {
            s = PL_origargv[0];
            s += strlen(s);