(Re-)implement alarm() for Win32.
[p5sagit/p5-mst-13.2.git] / taint.c
diff --git a/taint.c b/taint.c
index ab0b697..c25ff77 100644 (file)
--- a/taint.c
+++ b/taint.c
@@ -13,9 +13,26 @@ Perl_taint_proper(pTHX_ const char *f, const char *s)
 {
     char *ug;
 
-#ifdef HAS_SETEUID
-    DEBUG_u(PerlIO_printf(Perl_debug_log,
-            "%s %d %"Uid_t_f" %"Uid_t_f"\n", s, PL_tainted, PL_uid, PL_euid));
+#if defined(HAS_SETEUID) && defined(DEBUGGING)
+#   if Uid_t_size == 1
+    {
+        UV  uid = PL_uid;
+        UV euid = PL_euid;
+
+        DEBUG_u(PerlIO_printf(Perl_debug_log,
+                              "%s %d %"UVuf" %"UVuf"\n",
+                              s, PL_tainted, uid, euid));
+    }
+#   else
+    {
+        IV  uid = PL_uid;
+        IV euid = PL_euid;
+
+        DEBUG_u(PerlIO_printf(Perl_debug_log,
+                              "%s %d %"IVdf" %"IVdf"\n",
+                              s, PL_tainted, uid, euid));
+    }
+#   endif
 #endif
 
     if (PL_tainted) {
@@ -25,12 +42,17 @@ Perl_taint_proper(pTHX_ const char *f, const char *s)
            ug = " while running setuid";
        else if (PL_egid != PL_gid)
            ug = " while running setgid";
-       else
+       else if (PL_taint_warn)
+            ug = " while running with -t switch";
+        else
            ug = " while running with -T switch";
-       if (!PL_unsafe)
-           Perl_croak(aTHX_ f, s, ug);
-       else if (ckWARN(WARN_TAINT))
-           Perl_warner(aTHX_ WARN_TAINT, f, s, ug);
+       if (PL_unsafe || PL_taint_warn) {
+            if(ckWARN(WARN_TAINT))
+                Perl_warner(aTHX_ WARN_TAINT, f, s, ug);
+        }
+        else {
+            Perl_croak(aTHX_ f, s, ug);
+        }
     }
 }