From 582588d244ad30f176d66f31670f637b0bdb9884 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sun, 1 Oct 2006 20:22:02 +0000 Subject: [PATCH] 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 --- perlio.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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; -- 1.8.3.1