summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-06 09:22:19 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-06 09:22:19 +0000
commitecfefb70ee92eb56b3e3cc52134b06e05a423c42 (patch)
treee9e82f5e29e3ab545f39b1c4bc295902c8081f5a
parent4a5aa7590e0aa28105617c24c052629da5d4a151 (diff)
downloadppe42-gcc-ecfefb70ee92eb56b3e3cc52134b06e05a423c42.tar.gz
ppe42-gcc-ecfefb70ee92eb56b3e3cc52134b06e05a423c42.zip
* g-expect.adb (Get_Command_Output): When expanding the output buffer
we must ensure that there is enough place for the new data we are going to copy in. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123573 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/g-expect.adb15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/ada/g-expect.adb b/gcc/ada/g-expect.adb
index 9517905d410..ffbcfc3d86f 100644
--- a/gcc/ada/g-expect.adb
+++ b/gcc/ada/g-expect.adb
@@ -93,7 +93,7 @@ package body GNAT.Expect is
pragma Import (C, Kill, "__gnat_kill");
-- if Close is set to 1 all OS resources used by the Pid must be freed
- function Create_Pipe (Pipe : access Pipe_Type) return Integer;
+ function Create_Pipe (Pipe : not null access Pipe_Type) return Integer;
pragma Import (C, Create_Pipe, "__gnat_pipe");
function Poll
@@ -782,7 +782,7 @@ package body GNAT.Expect is
(Command : String;
Arguments : GNAT.OS_Lib.Argument_List;
Input : String;
- Status : access Integer;
+ Status : not null access Integer;
Err_To_Out : Boolean := False) return String
is
use GNAT.Expect;
@@ -821,10 +821,11 @@ package body GNAT.Expect is
pragma Assert (S'Length > 0);
begin
- -- Expand buffer if we need more space
+ -- Expand buffer if we need more space. Note here that we add
+ -- S'Length to ensure that S will fit in the new buffer size.
if Last + S'Length > Output'Last then
- NOutput := new String (1 .. 2 * Output'Last);
+ NOutput := new String (1 .. 2 * Output'Last + S'Length);
NOutput (Output'Range) := Output.all;
Free (Output);
@@ -1215,9 +1216,9 @@ package body GNAT.Expect is
procedure Set_Up_Communications
(Pid : in out Process_Descriptor;
Err_To_Out : Boolean;
- Pipe1 : access Pipe_Type;
- Pipe2 : access Pipe_Type;
- Pipe3 : access Pipe_Type)
+ Pipe1 : not null access Pipe_Type;
+ Pipe2 : not null access Pipe_Type;
+ Pipe3 : not null access Pipe_Type)
is
Status : Boolean;
OpenPOWER on IntegriCloud