This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ext/re/t/regop.t: Use eq instead of == for strings
[perl5.git] / taint.c
diff --git a/taint.c b/taint.c
index 4ebba5b..60a9a54 100644 (file)
--- a/taint.c
+++ b/taint.c
@@ -27,29 +27,22 @@ void
 Perl_taint_proper(pTHX_ const char *f, const char *const s)
 {
 #if defined(HAS_SETEUID) && defined(DEBUGGING)
-    dVAR;
-
     PERL_ARGS_ASSERT_TAINT_PROPER;
 
-#   if Uid_t_size == 1
     {
-       const UV  uid = PerlProc_getuid();
-       const UV euid = PerlProc_geteuid();
+       const Uid_t  uid = PerlProc_getuid();
+       const Uid_t euid = PerlProc_geteuid();
 
+#if Uid_t_sign == 1 /* uid_t is unsigned. */
        DEBUG_u(PerlIO_printf(Perl_debug_log,
-                              "%s %d %"UVuf" %"UVuf"\n",
-                              s, TAINT_get, uid, euid));
-    }
-#   else
-    {
-       const IV  uid = PerlProc_getuid();
-       const IV euid = PerlProc_geteuid();
-
+                              "%s %d %"UVuf" %"UVuf"\n",
+                              s, TAINT_get, (UV)uid, (UV)euid));
+#else /* uid_t is signed (Uid_t_sign == -1), or don't know. */
        DEBUG_u(PerlIO_printf(Perl_debug_log,
-                              "%s %d %"IVdf" %"IVdf"\n",
-                              s, TAINT_get, uid, euid));
+                              "%s %d %"IVdf" %"IVdf"\n",
+                              s, TAINT_get, (IV)uid, (IV)euid));
+#endif
     }
-#   endif
 #endif
 
     if (TAINT_get) {
@@ -65,19 +58,25 @@ Perl_taint_proper(pTHX_ const char *f, const char *const s)
             ug = " while running with -t switch";
         else
            ug = " while running with -T switch";
+
+        /* XXX because taint_proper adds extra format args, we can't
+         * get the caller to check properly; o we just silence the warning
+         * and hope the callers aren't naughty */
+        GCC_DIAG_IGNORE(-Wformat-nonliteral);
        if (PL_unsafe || TAINT_WARN_get) {
            Perl_ck_warner_d(aTHX_ packWARN(WARN_TAINT), f, s, ug);
         }
         else {
             Perl_croak(aTHX_ f, s, ug);
         }
+        GCC_DIAG_RESTORE;
+
     }
 }
 
 void
 Perl_taint_env(pTHX)
 {
-    dVAR;
     SV** svp;
     MAGIC* mg;
     const char* const *e;
@@ -110,6 +109,9 @@ Perl_taint_env(pTHX)
            taint_proper("%%ENV is aliased to %%%s%s", name);
        /* this statement is reached under -t or -U */
        TAINT_set(was_tainted);
+#ifdef NO_TAINT_SUPPORT
+        PERL_UNUSED_VAR(was_tainted);
+#endif
     }
 
 #ifdef VMS
@@ -157,7 +159,11 @@ Perl_taint_env(pTHX)
        const bool was_tainted = TAINT_get;
        const char *t = SvPV_const(*svp, len);
        const char * const e = t + len;
+
        TAINT_set(was_tainted);
+#ifdef NO_TAINT_SUPPORT
+        PERL_UNUSED_VAR(was_tainted);
+#endif
        if (t < e && isWORDCHAR(*t))
            t++;
        while (t < e && (isWORDCHAR(*t) || strchr("-_.+", *t)))