From cdd04b2dd68609adf653e0d2abd75d3475afc7ab Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sun, 19 Jul 2020 23:08:43 +0300 Subject: [PATCH] DswHostProcs: fix argument passing again --- src/posix/generic/Dsw/Mod/HostProcs.cp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/posix/generic/Dsw/Mod/HostProcs.cp b/src/posix/generic/Dsw/Mod/HostProcs.cp index 8516697..c056a8e 100644 --- a/src/posix/generic/Dsw/Mod/HostProcs.cp +++ b/src/posix/generic/Dsw/Mod/HostProcs.cp @@ -100,15 +100,16 @@ MODULE DswHostProcs; PROCEDURE (p: Process) Execute* (OUT ok: BOOLEAN); TYPE UString = POINTER [untagged] TO ARRAY [untagged] OF SHORTCHAR; - SUString = POINTER [untagged] TO ARRAY [untagged] OF UString; + SUString = POINTER TO ARRAY OF UString; VAR - i, j, adr: INTEGER; pid: unistd.pid_t; res: unistd.int; argv: SUString; + i: INTEGER; pid: unistd.pid_t; res: unistd.int; argv: SUString; s: String; BEGIN ASSERT(p.pid = -1, 20); ASSERT(p.argv # NIL, 21); - argv := SYSTEM.VAL(SUString, stdlib.malloc((LEN(p.argv) + 1)) * SIZE(UString)); + NEW(argv, LEN(p.argv) + 2); FOR i := 0 TO LEN(p.argv) - 1 DO - argv[i] := SYSTEM.VAL(UString, SYSTEM.ADR(p.argv[i, 0])) + s := p.argv[i]; + argv[i] := SYSTEM.VAL(UString, SYSTEM.ADR(s[0])) END; argv[i] := NIL; pid := unistd.fork(); @@ -122,8 +123,7 @@ MODULE DswHostProcs; p.argv := NIL; (* or save it for debugging and reuse? *) p.pid := pid; ok := TRUE - END; - stdlib.free(SYSTEM.ADR(argv[0])) + END END Execute; PROCEDURE (p: Process) Terminate* (OUT ok: BOOLEAN); -- 2.29.2