diff options
author | Rob Landley <rob@landley.net> | 2018-07-04 18:49:03 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2018-07-04 18:49:03 -0500 |
commit | ff2d528a0a6943bd4247f3c122c145a5b19f0387 (patch) | |
tree | e79c2baaa076a33deea48e65cf158b62ec6490da /lib/lib.c | |
parent | 4d673c9ad4c65c329a85ebb19c2812ae93183099 (diff) | |
download | toybox-ff2d528a0a6943bd4247f3c122c145a5b19f0387.tar.gz |
Add xgetrandom() with probe for new system call (else open/read /dev/{,u}random)
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -1144,9 +1144,7 @@ int qstrcmp(const void *a, const void *b) void create_uuid(char *uuid) { // "Set all the ... bits to randomly (or pseudo-randomly) chosen values". - int fd = xopenro("/dev/urandom"); - xreadall(fd, uuid, 16); - close(fd); + xgetrandom(uuid, 16, 0); // "Set the four most significant bits ... of the time_hi_and_version // field to the 4-bit version number [4]". |