authorgravatar for aleksey.kladov@gmail.comAlex Kladov <aleksey.kladov@gmail.com> 2026-04-18 16:44:55+01:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-04-20 01:20:52+02:00
log76174e1bcef30f5194fb06f1240ff1433cffa9ef
treecaa928415e815ee6e8a1923ac51a6ded13c65f6c
parentd840583458f03f5dcf75982e187e36796db8a9c8

fuzz: don't err if .zig-cache/tmp doesn't exist

If we have just created cache_dir_path, then there's no `tmp` dir there, and cache_dir.createFile(io, "tmp/libfuzzer.log", .{ .truncate = false }) fails. Tested via $ zig version 0.16.0 $ zig build --zig-lib-dir ~/p/zig/lib/ --fuzz

1 files changed, 2 insertions(+), 0 deletions(-)

lib/fuzzer.zig+2
...@@ -171,6 +171,8 @@ const Executable = struct {...@@ -171,6 +171,8 @@ const Executable = struct {
171171
172 const cache_dir = Io.Dir.cwd().createDirPathOpen(io, cache_dir_path, .{}) catch |e|172 const cache_dir = Io.Dir.cwd().createDirPathOpen(io, cache_dir_path, .{}) catch |e|
173 panic("failed to open directory '{s}': {t}", .{ cache_dir_path, e });173 panic("failed to open directory '{s}': {t}", .{ cache_dir_path, e });
174 cache_dir.createDirPath(io, "tmp") catch |e|
175 panic("failed to create directory 'tmp': {t}", .{e});
174 log_f = cache_dir.createFile(io, "tmp/libfuzzer.log", .{ .truncate = false }) catch |e|176 log_f = cache_dir.createFile(io, "tmp/libfuzzer.log", .{ .truncate = false }) catch |e|
175 panic("failed to create file 'tmp/libfuzzer.log': {t}", .{e});177 panic("failed to create file 'tmp/libfuzzer.log': {t}", .{e});
176 self.cache_f = cache_dir.createDirPathOpen(io, "f", .{}) catch |e|178 self.cache_f = cache_dir.createDirPathOpen(io, "f", .{}) catch |e|