ref: 38a6c760656267817632874f4a3e2bcf754b438e
parent: d9a91fc895bc8f8df0469e80374d8160c0e13bb8
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Sep 29 04:46:00 EDT 2015
Don't overwrite 'p' We use it to pass the args. Clobbeirng it would be suboptimal.
--- a/lib/sys/sys+linux-x64.myr
+++ b/lib/sys/sys+linux-x64.myr
@@ -726,11 +726,11 @@
const execve = {cmd, args, env
var cargs, cenv, i
- var p
+ var ap, ep
/* copy the args */
- p = alloca((args.len + 1)*sizeof(byte#))
- cargs = (p castto(byte##))[:args.len + 1]
+ ap = alloca((args.len + 1)*sizeof(byte#))
+ cargs = (ap castto(byte##))[:args.len + 1]
for i = 0; i < args.len; i++
cargs[i] = cstring(args[i])
;;
@@ -741,14 +741,14 @@
of course we fucking have to duplicate this code everywhere,
since we want to stack allocate...
*/
- p = alloca((env.len + 1)*sizeof(byte#))
- cenv = (p castto(byte##))[:env.len]
+ ep = alloca((env.len + 1)*sizeof(byte#))
+ cenv = (ep castto(byte##))[:env.len]
for i = 0; i < env.len; i++
cenv[i] = cstring(env[i])
;;
cenv[env.len] = 0 castto(byte#)
- -> syscall(Sysexecve, cstring(cmd), a(p), a(cenv))
+ -> syscall(Sysexecve, cstring(cmd), a(ap), a(ep))
}
/* file manipulation */