Fix compile errors about adding error.FileLocksNotSupported

This commit is contained in:
LeRoyce Pearson 2020-04-03 00:27:34 -06:00
parent 4dd0822a36
commit ea32a7d2bc
2 changed files with 5 additions and 2 deletions

View File

@ -1550,7 +1550,7 @@ pub fn walkPath(allocator: *Allocator, dir_path: []const u8) !Walker {
return walker;
}
pub const OpenSelfExeError = os.OpenError || os.windows.CreateFileError || SelfExePathError || os.FcntlError;
pub const OpenSelfExeError = os.OpenError || os.windows.CreateFileError || SelfExePathError || os.FlockError;
pub fn openSelfExe() OpenSelfExeError!File {
if (builtin.os.tag == .linux) {

View File

@ -3295,7 +3295,10 @@ pub fn realpathZ(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealP
return realpathW(&pathname_w, out_buffer);
}
if (builtin.os.tag == .linux and !builtin.link_libc) {
const fd = try openZ(pathname, linux.O_PATH | linux.O_NONBLOCK | linux.O_CLOEXEC, 0);
const fd = openZ(pathname, linux.O_PATH | linux.O_NONBLOCK | linux.O_CLOEXEC, 0) catch |err| switch (err) {
error.FileLocksNotSupported => unreachable,
else => |e| return e,
};
defer close(fd);
var procfs_buf: ["/proc/self/fd/-2147483648".len:0]u8 = undefined;