mwrap (Perl version) user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] rproxy: avoid uninitialized stat w/o debugperl
@ 2023-01-07  9:08 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-01-07  9:08 UTC (permalink / raw)
  To: mwrap-perl

The `_' stat cache is cleared if `-x' fails, so ensure we
capture it cheaply from the preceding `-e' before attempting
`-x "/usr/bin/debugperl"'.
---
 lib/Devel/Mwrap/Rproxy.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/Devel/Mwrap/Rproxy.pm b/lib/Devel/Mwrap/Rproxy.pm
index e2b7097..d5a9d9d 100644
--- a/lib/Devel/Mwrap/Rproxy.pm
+++ b/lib/Devel/Mwrap/Rproxy.pm
@@ -82,11 +82,13 @@ sub resolve_exe ($$) {
 		$exe = ($l =~ /\A\#\![ \t]*(\S+)/) ? $1 : $^X;
 	}
 	return unless -e $exe;
+	my @st = stat(_);
 
 	# Debian `perl-debug' is special:
-	($exe eq '/usr/bin/perl' && -x '/usr/bin/debugperl') and
+	if ($exe eq '/usr/bin/perl' && -x '/usr/bin/debugperl') {
+		@st = stat(_);
 		$exe = '/usr/bin/debugperl';
-	my @st = stat(_);
+	}
 	$$st = pack('dd', $st[10], $st[7]); # ctime + size
 	$exe;
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-07  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07  9:08 [PATCH] rproxy: avoid uninitialized stat w/o debugperl Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mwrap-perl.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).