[Ada] Avoid to close irrelevant file descriptors
authorVadim Godunko <godunko@adacore.com>
Tue, 17 Sep 2019 08:01:37 +0000 (08:01 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 17 Sep 2019 08:01:37 +0000 (08:01 +0000)
commitb9bfbf45419a641c0b92b1954b94b73cb3dfb935
tree3414ebf9359be4033522a266d02d86152200964d
parentee7c961db9da34d3e437eba0088f7291a7a5dfb4
[Ada] Avoid to close irrelevant file descriptors

'Close' subprogram of GNAT.Expect can close irrelevant file descriptors
when 'Expect' was terminated by Process_Died exception and any file open
operations was done before call to 'Close'.

2019-09-17  Vadim Godunko  <godunko@adacore.com>

gcc/ada/

* libgnat/g-expect.ads, libgnat/g-expect.adb (Close_Input): New
subprogram.
(Get_Command_Output): Call Close_Input to close input stream.
(Expect_Internal): Likewise.
(Close): Likewise.
* libgnat/g-exptty.adb (Close): Likewise.

gcc/testsuite/

* gnat.dg/expect3.adb: New testcase.

From-SVN: r275781
gcc/ada/ChangeLog
gcc/ada/libgnat/g-expect.adb
gcc/ada/libgnat/g-expect.ads
gcc/ada/libgnat/g-exptty.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/expect3.adb [new file with mode: 0644]