authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-08-23 19:25:11-07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-08-23 19:25:11-07:00
log6ca77ebd1d497bed27c5c74071e6c2ae9f8649a1
tree2e478e42e9d89edbc952d50e843e9cf0d28677ee
parent95b36afadfe436856757013206db6c7048ff69c2
signature Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

mktemp(): ensure the file returned is new


1 files changed, 3 insertions(+), 1 deletions(-)

nfs.zig+3-1
...@@ -70,7 +70,9 @@ pub fn mktemp(flags: Dir.CreateFlags) !File {...@@ -70,7 +70,9 @@ pub fn mktemp(flags: Dir.CreateFlags) !File {
70 const rand = nio.randomBytes(10);70 const rand = nio.randomBytes(10);
71 for (template[9..][0..10], rand) |*a, b| a.* = letters[b % 62];71 for (template[9..][0..10], rand) |*a, b| a.* = letters[b % 62];
72 const path = template[0 .. template.len - 1 :0];72 const path = template[0 .. template.len - 1 :0];
73 return cwd().createFile(path, flags);73 var _flags = flags;
74 _flags.exclusive = true;
75 return cwd().createFile(path, _flags);
74}76}
7577
76pub fn pipe2(flag: c_int) ![2]File {78pub fn pipe2(flag: c_int) ![2]File {