summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-10-01 20:22:02 +0000
committerNicholas Clark <nick@ccl4.org>2006-10-01 20:22:02 +0000
commit582588d244ad30f176d66f31670f637b0bdb9884 (patch)
tree3aad5e45446450f5b43f58b626f32632955ede15 /perlio.c
parentf0a78170a1cd45c5019f6c77288041aa0767e0ff (diff)
downloadperl-582588d244ad30f176d66f31670f637b0bdb9884.tar.gz
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
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/perlio.c b/perlio.c
index a3ff71d889..ddc0ad8309 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;