authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-09 23:34:08-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-12 00:14:08-07:00
log2ebf021061b8789226fa8bafe36f7827925d7022
treed6b928d9c8a88267d7e5d2a020ae58be14a2af3b
parent7bccef3e4e4d48c2e1d34ec28754d8c33902f2bb

build runner: don't pass a dirfd + null to fanotify_mark

Otherwise it reports EBADF.

2 files changed, 6 insertions(+), 2 deletions(-)

lib/compiler/build_runner.zig+2-2
......@@ -419,7 +419,7 @@ pub fn main() !void {
419419 std.posix.fanotify_mark(w.fan_fd, .{
420420 .ADD = true,
421421 .ONLYDIR = true,
422 }, Watch.fan_mask, path.root_dir.handle.fd, path.subPathOpt()) catch |err| {
422 }, Watch.fan_mask, path.root_dir.handle.fd, path.subPathOrDot()) catch |err| {
423423 fatal("unable to watch {}: {s}", .{ path, @errorName(err) });
424424 };
425425
......@@ -471,7 +471,7 @@ pub fn main() !void {
471471 try std.posix.fanotify_mark(w.fan_fd, .{
472472 .REMOVE = true,
473473 .ONLYDIR = true,
474 }, Watch.fan_mask, path.root_dir.handle.fd, path.subPathOpt());
474 }, Watch.fan_mask, path.root_dir.handle.fd, path.subPathOrDot());
475475
476476 w.dir_table.swapRemoveAt(i);
477477 w.handle_table.swapRemoveAt(i);
lib/std/Build/Cache/Path.zig+4
......@@ -173,6 +173,10 @@ pub fn subPathOpt(self: Path) ?[]const u8 {
173173 return if (self.sub_path.len == 0) null else self.sub_path;
174174}
175175
176pub fn subPathOrDot(self: Path) []const u8 {
177 return if (self.sub_path.len == 0) "." else self.sub_path;
178}
179
176180/// Useful to make `Path` a key in `std.ArrayHashMap`.
177181pub const TableAdapter = struct {
178182 pub const Hash = std.hash.Wyhash;