aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Godunko <godunko@adacore.com>2019-09-17 08:01:42 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-09-17 08:01:42 +0000
commit19716ceb1676e1a947527b3ae1d59dce646dd76c (patch)
tree74d2ffa557ea394abd18088874c1a9183c3c4900
parentb9bfbf45419a641c0b92b1954b94b73cb3dfb935 (diff)
downloadgcc-19716ceb1676e1a947527b3ae1d59dce646dd76c.zip
gcc-19716ceb1676e1a947527b3ae1d59dce646dd76c.tar.gz
gcc-19716ceb1676e1a947527b3ae1d59dce646dd76c.tar.bz2
[Ada] GNAT.Expect (Expect_Internal): Try to call 'poll' few times
'poll' returns -1 in case of any error (including interruption by a signal), so call need to be repeated few times to avoid false failures. 2019-09-17 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-expect.adb (Expect_Internal): Try to call 'poll' few times. From-SVN: r275782
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/libgnat/g-expect.adb13
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c952898..ab8c8a5 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2019-09-17 Vadim Godunko <godunko@adacore.com>
+ * libgnat/g-expect.adb (Expect_Internal): Try to call 'poll' few
+ times.
+
+2019-09-17 Vadim Godunko <godunko@adacore.com>
+
* libgnat/g-expect.ads, libgnat/g-expect.adb (Close_Input): New
subprogram.
(Get_Command_Output): Call Close_Input to close input stream.
diff --git a/gcc/ada/libgnat/g-expect.adb b/gcc/ada/libgnat/g-expect.adb
index b44c7a5..0ee010e 100644
--- a/gcc/ada/libgnat/g-expect.adb
+++ b/gcc/ada/libgnat/g-expect.adb
@@ -679,8 +679,17 @@ package body GNAT.Expect is
-- Loop until we match or we have a timeout
loop
- Num_Descriptors :=
- Poll (Fds'Address, Fds_Count, Timeout, D'Access, Is_Set'Address);
+ -- Poll may be interrupted on Linux by a signal and need to be
+ -- repeated. We don't want to check for errno = EINTER, so just
+ -- attempt to call Poll a few times.
+
+ for J in 1 .. 3 loop
+ Num_Descriptors :=
+ Poll
+ (Fds'Address, Fds_Count, Timeout, D'Access, Is_Set'Address);
+
+ exit when Num_Descriptors /= -1;
+ end loop;
case Num_Descriptors is