aboutsummaryrefslogtreecommitdiff
path: root/std/os
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-04-04 06:47:42 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-04-04 06:47:42 -0400
commit9c803af044a2d7fb5f83e35ea64dcd045f891d48 (patch)
tree99f4356b3f32306b157edd3584d21bab784b9541 /std/os
parent00efbfa0543b74add239e8f9b7b3cf94988b5f52 (diff)
downloadzig-9c803af044a2d7fb5f83e35ea64dcd045f891d48.tar.gz
zig-9c803af044a2d7fb5f83e35ea64dcd045f891d48.zip
zig build system: fix cleanup on error, report spawn error
Diffstat (limited to 'std/os')
-rw-r--r--std/os/index.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/std/os/index.zig b/std/os/index.zig
index 7412fad82f..90ff053dba 100644
--- a/std/os/index.zig
+++ b/std/os/index.zig
@@ -215,8 +215,8 @@ pub fn posixExecve(path: []const u8, argv: []const []const u8, env_map: &const B
const argv_buf = %return allocator.alloc(?&const u8, argv.len + 2);
mem.set(?&const u8, argv_buf, null);
defer {
- for (argv_buf) |arg, i| {
- const arg_buf = if (const ptr ?= arg) ptr[0...argv[i].len + 1] else break;
+ for (argv_buf) |arg| {
+ const arg_buf = if (const ptr ?= arg) ptr[0...cstr.len(ptr)] else break;
allocator.free(arg_buf);
}
allocator.free(argv_buf);
@@ -242,7 +242,7 @@ pub fn posixExecve(path: []const u8, argv: []const []const u8, env_map: &const B
const envp_buf = %return allocator.alloc(?&const u8, envp_count + 1);
mem.set(?&const u8, envp_buf, null);
defer {
- for (envp_buf) |env, i| {
+ for (envp_buf) |env| {
const env_buf = if (const ptr ?= env) ptr[0...cstr.len(ptr)] else break;
allocator.free(env_buf);
}