From: Ian Jackson Date: Sun, 21 Aug 2022 10:19:17 +0000 (+0100) Subject: prefork-interp: properly handle EINTR in monitor X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=689f49612660745b546017187c8cbdea6bb4fd3e;p=chiark-utils.git prefork-interp: properly handle EINTR in monitor Signed-off-by: Ian Jackson --- diff --git a/pm/Proc/Prefork/Interp.pm b/pm/Proc/Prefork/Interp.pm index 3b38ffa..d1d99ee 100644 --- a/pm/Proc/Prefork/Interp.pm +++ b/pm/Proc/Prefork/Interp.pm @@ -65,11 +65,16 @@ sub become_monitor () { #---- monitor [2] ---- - my $rbits = ''; - vec($rbits, fileno(CALL), 1) = 1; - vec($rbits, fileno(EXECTERM), 1) = 1; - my $ebits = $rbits; - my $nfound = select($rbits, '', $ebits, undef); + for (;;) { + my $rbits = ''; + vec($rbits, fileno(CALL), 1) = 1; + vec($rbits, fileno(EXECTERM), 1) = 1; + my $ebits = $rbits; + my $nfound = select($rbits, '', $ebits, undef); + last if $nfound > 0; + next if $! == EINTR; + fail_log("monitor select() failed: $!"); + } # Either the child has just died, or the caller has gone away