aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os.zig
diff options
context:
space:
mode:
authorg-w1 <58830309+g-w1@users.noreply.github.com>2020-11-18 02:42:35 -0500
committerGitHub <noreply@github.com>2020-11-18 08:42:35 +0100
commita0226ab05b50341622ace8314bdad3da7cd7e35d (patch)
treef200ba0b5dd6aacde4428b13f19f5c6ab5743b45 /lib/std/os.zig
parent238718b93abfe97bd5531103cf39714ec66fd86e (diff)
downloadzig-a0226ab05b50341622ace8314bdad3da7cd7e35d.tar.gz
zig-a0226ab05b50341622ace8314bdad3da7cd7e35d.zip
std: openDirAbsolute and accessAbsolute (#7082)
* add more abosolutes * added wrong files * adding 2 tests and changing the function signatures because of lazy analysis not checking them * fix a bug that got uncovered by lazy eval * Add compile error when using WASI with openDirAbsolute and accessAbsolute * typo
Diffstat (limited to 'lib/std/os.zig')
-rw-r--r--lib/std/os.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 2ea26f8b1e..91b88304f7 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -4453,11 +4453,11 @@ pub fn sched_getaffinity(pid: pid_t) SchedGetAffinityError!cpu_set_t {
/// Used to convert a slice to a null terminated slice on the stack.
/// TODO https://github.com/ziglang/zig/issues/287
-pub fn toPosixPath(file_path: []const u8) ![PATH_MAX - 1:0]u8 {
+pub fn toPosixPath(file_path: []const u8) ![MAX_PATH_BYTES - 1:0]u8 {
if (std.debug.runtime_safety) assert(std.mem.indexOfScalar(u8, file_path, 0) == null);
- var path_with_null: [PATH_MAX - 1:0]u8 = undefined;
+ var path_with_null: [MAX_PATH_BYTES - 1:0]u8 = undefined;
// >= rather than > to make room for the null byte
- if (file_path.len >= PATH_MAX) return error.NameTooLong;
+ if (file_path.len >= MAX_PATH_BYTES) return error.NameTooLong;
mem.copy(u8, &path_with_null, file_path);
path_with_null[file_path.len] = 0;
return path_with_null;