From: DeaDDooMER Date: Sun, 8 Mar 2020 12:45:31 +0000 (+0300) Subject: DswHostProcs: hack-fix for cpfront X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=72ea2ac507516619045fcb5c9620cebc12fd4217;p=cpc.git DswHostProcs: hack-fix for cpfront --- diff --git a/src/posix/generic/Dsw/Mod/HostProcs.cp b/src/posix/generic/Dsw/Mod/HostProcs.cp index 2aa4758..8516697 100644 --- a/src/posix/generic/Dsw/Mod/HostProcs.cp +++ b/src/posix/generic/Dsw/Mod/HostProcs.cp @@ -100,16 +100,17 @@ MODULE DswHostProcs; PROCEDURE (p: Process) Execute* (OUT ok: BOOLEAN); TYPE UString = POINTER [untagged] TO ARRAY [untagged] OF SHORTCHAR; - SUString = POINTER TO ARRAY OF UString; + SUString = POINTER [untagged] TO ARRAY [untagged] OF UString; VAR - i, j: INTEGER; pid: unistd.pid_t; res: unistd.int; argv: SUString; + i, j, adr: INTEGER; pid: unistd.pid_t; res: unistd.int; argv: SUString; BEGIN ASSERT(p.pid = -1, 20); ASSERT(p.argv # NIL, 21); - NEW(argv, LEN(p.argv) + 1); + argv := SYSTEM.VAL(SUString, stdlib.malloc((LEN(p.argv) + 1)) * SIZE(UString)); FOR i := 0 TO LEN(p.argv) - 1 DO argv[i] := SYSTEM.VAL(UString, SYSTEM.ADR(p.argv[i, 0])) END; + argv[i] := NIL; pid := unistd.fork(); IF pid = 0 THEN res := unistd.execv(argv[0], argv); @@ -121,7 +122,8 @@ MODULE DswHostProcs; p.argv := NIL; (* or save it for debugging and reuse? *) p.pid := pid; ok := TRUE - END + END; + stdlib.free(SYSTEM.ADR(argv[0])) END Execute; PROCEDURE (p: Process) Terminate* (OUT ok: BOOLEAN);