aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fs.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-12-18 23:57:46 -0500
committerGitHub <noreply@github.com>2020-12-18 23:57:46 -0500
commit506af7e52e0985b410ea089bf5fa3247ab2377cb (patch)
tree2ec26d70f41a1382b736b606ebfa094ace62573e /lib/std/fs.zig
parentce65533985caa9e2da567948e36d7d4ba0185005 (diff)
parentf416535768fc30195cad6cd481f73fd1e80082aa (diff)
downloadzig-506af7e52e0985b410ea089bf5fa3247ab2377cb.tar.gz
zig-506af7e52e0985b410ea089bf5fa3247ab2377cb.zip
Merge pull request #7482 from ziglang/tlcsprng
std: introduce a thread-local CSPRNG for general use
Diffstat (limited to 'lib/std/fs.zig')
-rw-r--r--lib/std/fs.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index 8b949a57f1..4c346a2c89 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -82,7 +82,7 @@ pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path:
mem.copy(u8, tmp_path[0..], dirname);
tmp_path[dirname.len] = path.sep;
while (true) {
- try crypto.randomBytes(rand_buf[0..]);
+ crypto.random.bytes(rand_buf[0..]);
base64_encoder.encode(tmp_path[dirname.len + 1 ..], &rand_buf);
if (cwd().symLink(existing_path, tmp_path, .{})) {
@@ -157,7 +157,7 @@ pub const AtomicFile = struct {
tmp_path_buf[base64.Base64Encoder.calcSize(RANDOM_BYTES)] = 0;
while (true) {
- try crypto.randomBytes(rand_buf[0..]);
+ crypto.random.bytes(rand_buf[0..]);
base64_encoder.encode(&tmp_path_buf, &rand_buf);
const file = dir.createFile(