diff options
author | default <nobody@localhost> | 2023-06-05 18:29:25 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-06-05 18:29:25 +0200 |
commit | fafdbbf815ea44ca1813a4ab58547d487f6a3bfb (patch) | |
tree | 139aeaf983b3b634f4b3bdfa57bb63876bb2cf68 /mastoapi.c | |
parent | e788a5bf8fde50cc8ba30390f829bb78e18add4d (diff) |
Replaced usage of random() with xs_rnd_buf().
Diffstat (limited to 'mastoapi.c')
-rw-r--r-- | mastoapi.c | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -10,6 +10,7 @@ #include "xs_time.h" #include "xs_glob.h" #include "xs_set.h" +#include "xs_random.h" #include "snac.h" @@ -17,19 +18,8 @@ static xs_str *random_str(void) /* just what is says in the tin */ { unsigned int data[4] = {0}; - FILE *f; - - if ((f = fopen("/dev/random", "r")) != NULL) { - fread(data, sizeof(data), 1, f); - fclose(f); - } - else { - data[0] = random() % 0xffffffff; - data[1] = random() % 0xffffffff; - data[2] = random() % 0xffffffff; - data[3] = random() % 0xffffffff; - } + xs_rnd_buf(data, sizeof(data)); return xs_hex_enc((char *)data, sizeof(data)); } |