crypto TLS bundle: make AddCertsFromDirPathError compile

It's calling `addCertsFromDir`, which now requires a timestamp,
so it didn't compile any more.

Add a test by the way.
This commit is contained in:
Frank Denis
2026-04-11 13:39:49 +02:00
committed by Andrew Kelley
parent 41bc507688
commit bc08199ef1
+15 -1
View File
@@ -184,7 +184,8 @@ pub fn addCertsFromDirPath(
) AddCertsFromDirPathError!void {
var iterable_dir = try dir.openDir(io, sub_dir_path, .{ .iterate = true });
defer iterable_dir.close(io);
return addCertsFromDir(cb, gpa, io, iterable_dir);
const now = Io.Clock.real.now(io);
return addCertsFromDir(cb, gpa, io, now, iterable_dir);
}
pub fn addCertsFromDirPathAbsolute(
@@ -331,6 +332,19 @@ const MapContext = struct {
}
};
test "addCertsFromDirPath compiles and accepts an empty directory" {
const io = std.testing.io;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{ .iterate = true });
defer tmp.cleanup();
var bundle: Bundle = .empty;
defer bundle.deinit(gpa);
try bundle.addCertsFromDirPath(gpa, io, tmp.dir, ".");
}
test "scan for OS-provided certificates" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;