summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2020-11-29 14:24:14 +0100
committerDenys Vlasenko2020-11-29 14:24:14 +0100
commiteb773054e47a30c78a82ed80ad4da7abe9bfb09b (patch)
tree839f7ed43525db03f95012cbba2ee3d576cb3a3e /libbb
parent6a55b4e403979ba299261816a7ec1bb55bbf3f2b (diff)
downloadbusybox-eb773054e47a30c78a82ed80ad4da7abe9bfb09b.zip
busybox-eb773054e47a30c78a82ed80ad4da7abe9bfb09b.tar.gz
libbb: code shrink
function old new delta generate_uuid 124 103 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xfuncs_printf.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index f1cf7ae..fcc7986 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -633,14 +633,11 @@ void FAST_FUNC generate_uuid(uint8_t *buf)
pid_t pid;
int i;
- i = open("/dev/urandom", O_RDONLY);
- if (i >= 0) {
- read(i, buf, 16);
- close(i);
- }
+ open_read_close("/dev/urandom", buf, 16);
/* Paranoia. /dev/urandom may be missing.
* rand() is guaranteed to generate at least [0, 2^15) range,
- * but lowest bits in some libc are not so "random". */
+ * but lowest bits in some libc are not so "random".
+ */
srand(monotonic_us()); /* pulls in printf */
pid = getpid();
while (1) {