In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/69374fe705978962b85217f3eb828a93f836fd8d?hp=b8897079199ab3165b21ca3aff78c7479842181a>
- Log ----------------------------------------------------------------- commit 69374fe705978962b85217f3eb828a93f836fd8d Author: Zefram <zef...@fysh.org> Date: Sat Nov 11 23:58:32 2017 +0000 avoid reading errno twice in a row Reading errno can involve calling a function and indirecting through its result, so cache the value of errno where possible. [perl #122096] ----------------------------------------------------------------------- Summary of changes: perl.c | 5 +++-- win32/win32.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/perl.c b/perl.c index bf48b31493..d50bac7cc4 100644 --- a/perl.c +++ b/perl.c @@ -5231,8 +5231,9 @@ Perl_my_failure_exit(pTHX) #else int exitstatus; - if (errno & 255) - STATUS_UNIX_SET(errno); + int eno = errno; + if (eno & 255) + STATUS_UNIX_SET(eno); else { exitstatus = STATUS_UNIX >> 8; if (exitstatus & 255) diff --git a/win32/win32.c b/win32/win32.c index 89522abaca..c7656c631b 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -619,6 +619,7 @@ Perl_do_aspawn(pTHX_ SV *really, SV **mark, SV **sp) int status; int flag = P_WAIT; int index = 0; + int eno; PERL_ARGS_ASSERT_DO_ASPAWN; @@ -645,7 +646,7 @@ Perl_do_aspawn(pTHX_ SV *really, SV **mark, SV **sp) (const char*)(really ? SvPV_nolen(really) : argv[0]), (const char* const*)argv); - if (status < 0 && (errno == ENOEXEC || errno == ENOENT)) { + if (status < 0 && (eno = errno, (eno == ENOEXEC || eno == ENOENT))) { /* possible shell-builtin, invoke with shell */ int sh_items; sh_items = w32_perlshell_items; -- Perl5 Master Repository