authorgravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-20 20:57:58-02:00
committergravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-20 20:57:58-02:00
log46a0f60e4c0c91f840982cb98066d60301624548
treed732cea118c8d1f3b90f00565d36661473ca9080
parentac1b2a3c7319b099211acdca91c644a8533d0970
signaturelock-open Commit is signed but in an unrecognized format.

freebsd: use realpath() to resolve symbolic links


1 files changed, 1 insertions(+), 10 deletions(-)

std/os/path.zig+1-10
......@@ -1161,7 +1161,7 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro
11611161 const pathname_w = try windows_util.cStrToPrefixedFileW(pathname);
11621162 return realW(out_buffer, pathname_w);
11631163 },
1164 Os.macosx, Os.ios => {
1164 Os.freebsd, Os.macosx, Os.ios => {
11651165 // TODO instead of calling the libc function here, port the implementation to Zig
11661166 const err = posix.getErrno(posix.realpath(pathname, out_buffer));
11671167 switch (err) {
......@@ -1188,15 +1188,6 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro
11881188
11891189 return os.readLinkC(out_buffer, proc_path.ptr);
11901190 },
1191 Os.freebsd => { // XXX requires fdescfs
1192 const fd = try os.posixOpenC(pathname, posix.O_PATH | posix.O_NONBLOCK | posix.O_CLOEXEC, 0);
1193 defer os.close(fd);
1194
1195 var buf: ["/dev/fd/-2147483648\x00".len]u8 = undefined;
1196 const proc_path = fmt.bufPrint(buf[0..], "/dev/fd/{}\x00", fd) catch unreachable;
1197
1198 return os.readLinkC(out_buffer, proc_path.ptr);
1199 },
12001191 else => @compileError("TODO implement os.path.real for " ++ @tagName(builtin.os)),
12011192 }
12021193}