From: Nicholas Clark Date: Sun, 1 Oct 2006 20:22:02 +0000 (+0000) Subject: In PerlIO_debug(), if tainting or set*id, set PL_perlio_debug_fd to -1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=582588d244ad30f176d66f31670f637b0bdb9884;p=p5sagit%2Fp5-mst-13.2.git In PerlIO_debug(), if tainting or set*id, set PL_perlio_debug_fd to -1 first time through to reduce the checks on subsequent calls. p4raw-id: //depot/perl@28911 --- diff --git a/perlio.c b/perlio.c index a3ff71d..ddc0ad8 100644 --- a/perlio.c +++ b/perlio.c @@ -473,12 +473,19 @@ PerlIO_debug(const char *fmt, ...) va_list ap; dSYS; va_start(ap, fmt); - if (!PL_perlio_debug_fd && !PL_tainting && PL_uid == PL_euid && PL_gid == PL_egid) { - const char * const s = PerlEnv_getenv("PERLIO_DEBUG"); - if (s && *s) - PL_perlio_debug_fd = PerlLIO_open3(s, O_WRONLY | O_CREAT | O_APPEND, 0666); - else + if (!PL_perlio_debug_fd) { + if (!PL_tainting && PL_uid == PL_euid && PL_gid == PL_egid) { + const char * const s = PerlEnv_getenv("PERLIO_DEBUG"); + if (s && *s) + PL_perlio_debug_fd + = PerlLIO_open3(s, O_WRONLY | O_CREAT | O_APPEND, 0666); + else + PL_perlio_debug_fd = -1; + } else { + /* tainting or set*id, so ignore the environment, and ensure we + skip these tests next time through. */ PL_perlio_debug_fd = -1; + } } if (PL_perlio_debug_fd > 0) { dTHX;