This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
POPLOOP(): no need to mortalise current item
[perl5.git] / mg.c
diff --git a/mg.c b/mg.c
index f8d8f33..4321a40 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2577,7 +2577,6 @@ S_set_dollarzero(pTHX_ SV *sv)
 #endif
     const char *s;
     STRLEN len;
-    I32 i;
 #ifdef HAS_SETPROCTITLE
     /* The BSDs don't show the argv[] in ps(1) output, they
      * show a string from the process struct and provide
@@ -2610,6 +2609,7 @@ S_set_dollarzero(pTHX_ SV *sv)
     }
 #else
     if (PL_origalen > 1) {
+        I32 i;
         /* PL_origalen is set in perl_parse(). */
         s = SvPV_force(sv,len);
         if (len >= (STRLEN)PL_origalen-1) {
@@ -3340,13 +3340,27 @@ Perl_sighandler(int sig)
                    * addr, status, and band are defined by POSIX/SUSv3. */
                   (void)hv_stores(sih, "signo", newSViv(sip->si_signo));
                   (void)hv_stores(sih, "code", newSViv(sip->si_code));
-#if 0 /* XXX TODO: Configure scan for the existence of these, but even that does not help if the SA_SIGINFO is not implemented according to the spec. */
-                  hv_stores(sih, "errno",      newSViv(sip->si_errno));
-                  hv_stores(sih, "status",     newSViv(sip->si_status));
-                  hv_stores(sih, "uid",        newSViv(sip->si_uid));
-                  hv_stores(sih, "pid",        newSViv(sip->si_pid));
-                  hv_stores(sih, "addr",       newSVuv(PTR2UV(sip->si_addr)));
-                  hv_stores(sih, "band",       newSViv(sip->si_band));
+#ifdef HAS_SIGINFO_SI_ERRNO
+                  (void)hv_stores(sih, "errno",      newSViv(sip->si_errno));
+#endif
+#ifdef HAS_SIGINFO_SI_STATUS
+                  (void)hv_stores(sih, "status",     newSViv(sip->si_status));
+#endif
+#ifdef HAS_SIGINFO_SI_UID
+                  {
+                       SV *uid = newSV(0);
+                       sv_setuid(uid, sip->si_uid);
+                       (void)hv_stores(sih, "uid", uid);
+                  }
+#endif
+#ifdef HAS_SIGINFO_SI_PID
+                  (void)hv_stores(sih, "pid",        newSViv(sip->si_pid));
+#endif
+#ifdef HAS_SIGINFO_SI_ADDR
+                  (void)hv_stores(sih, "addr",       newSVuv(PTR2UV(sip->si_addr)));
+#endif
+#ifdef HAS_SIGINFO_SI_BAND
+                  (void)hv_stores(sih, "band",       newSViv(sip->si_band));
 #endif
                   EXTEND(SP, 2);
                   PUSHs(rv);