chiark / gitweb /
prefork-interp: properly handle EINTR in monitor
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Aug 2022 10:19:17 +0000 (11:19 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Aug 2022 20:21:10 +0000 (21:21 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
pm/Proc/Prefork/Interp.pm

index 3b38ffac79ffc6f11cf9b5970944ae352bfde3f1..d1d99ee03004aed3cabd764c9c6fb2ec7dac9a6a 100644 (file)
@@ -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