aboutsummaryrefslogtreecommitdiff
path: root/std/process.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-08-03 12:39:15 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-08-03 12:39:15 -0400
commit63ebd9d12e48765514777418e12f55576ff63509 (patch)
tree05f40973b86f91bffd6458247bd9cd2c3d66b72d /std/process.zig
parenta2e1be0346c364c4327dc2b81bbcdeca12414dab (diff)
parent5687323cd2a759dfdf9533e46e3de8cddb1b55b7 (diff)
downloadzig-63ebd9d12e48765514777418e12f55576ff63509.tar.gz
zig-63ebd9d12e48765514777418e12f55576ff63509.zip
Merge remote-tracking branch 'origin/master' into llvm9
Diffstat (limited to 'std/process.zig')
-rw-r--r--std/process.zig3
1 files changed, 1 insertions, 2 deletions
diff --git a/std/process.zig b/std/process.zig
index b39c6e1196..c74e8c43be 100644
--- a/std/process.zig
+++ b/std/process.zig
@@ -146,13 +146,12 @@ pub fn getEnvVarOwned(allocator: *mem.Allocator, key: []const u8) GetEnvVarOwned
error.Unexpected => return error.EnvironmentVariableNotFound,
else => |e| return e,
};
-
if (result > buf.len) {
buf = try allocator.realloc(buf, result);
continue;
}
- return std.unicode.utf16leToUtf8Alloc(allocator, buf) catch |err| switch (err) {
+ return std.unicode.utf16leToUtf8Alloc(allocator, buf[0..result]) catch |err| switch (err) {
error.DanglingSurrogateHalf => return error.InvalidUtf8,
error.ExpectedSecondSurrogateHalf => return error.InvalidUtf8,
error.UnexpectedSecondSurrogateHalf => return error.InvalidUtf8,