mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 00:08:56 +00:00
freebsd: use realpath() to resolve symbolic links
This commit is contained in:
parent
ac1b2a3c73
commit
46a0f60e4c
@ -1161,7 +1161,7 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro
|
||||
const pathname_w = try windows_util.cStrToPrefixedFileW(pathname);
|
||||
return realW(out_buffer, pathname_w);
|
||||
},
|
||||
Os.macosx, Os.ios => {
|
||||
Os.freebsd, Os.macosx, Os.ios => {
|
||||
// TODO instead of calling the libc function here, port the implementation to Zig
|
||||
const err = posix.getErrno(posix.realpath(pathname, out_buffer));
|
||||
switch (err) {
|
||||
@ -1188,15 +1188,6 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro
|
||||
|
||||
return os.readLinkC(out_buffer, proc_path.ptr);
|
||||
},
|
||||
Os.freebsd => { // XXX requires fdescfs
|
||||
const fd = try os.posixOpenC(pathname, posix.O_PATH | posix.O_NONBLOCK | posix.O_CLOEXEC, 0);
|
||||
defer os.close(fd);
|
||||
|
||||
var buf: ["/dev/fd/-2147483648\x00".len]u8 = undefined;
|
||||
const proc_path = fmt.bufPrint(buf[0..], "/dev/fd/{}\x00", fd) catch unreachable;
|
||||
|
||||
return os.readLinkC(out_buffer, proc_path.ptr);
|
||||
},
|
||||
else => @compileError("TODO implement os.path.real for " ++ @tagName(builtin.os)),
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user