diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-11-29 14:24:14 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-11-29 14:24:14 +0100 |
| commit | eb773054e47a30c78a82ed80ad4da7abe9bfb09b (patch) | |
| tree | 839f7ed43525db03f95012cbba2ee3d576cb3a3e | |
| parent | 6a55b4e403979ba299261816a7ec1bb55bbf3f2b (diff) | |
| download | busybox-w32-eb773054e47a30c78a82ed80ad4da7abe9bfb09b.tar.gz busybox-w32-eb773054e47a30c78a82ed80ad4da7abe9bfb09b.tar.bz2 busybox-w32-eb773054e47a30c78a82ed80ad4da7abe9bfb09b.zip | |
libbb: code shrink
function old new delta
generate_uuid 124 103 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | libbb/xfuncs_printf.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c index f1cf7aeed..fcc798662 100644 --- a/libbb/xfuncs_printf.c +++ b/libbb/xfuncs_printf.c | |||
| @@ -633,14 +633,11 @@ void FAST_FUNC generate_uuid(uint8_t *buf) | |||
| 633 | pid_t pid; | 633 | pid_t pid; |
| 634 | int i; | 634 | int i; |
| 635 | 635 | ||
| 636 | i = open("/dev/urandom", O_RDONLY); | 636 | open_read_close("/dev/urandom", buf, 16); |
| 637 | if (i >= 0) { | ||
| 638 | read(i, buf, 16); | ||
| 639 | close(i); | ||
| 640 | } | ||
| 641 | /* Paranoia. /dev/urandom may be missing. | 637 | /* Paranoia. /dev/urandom may be missing. |
| 642 | * rand() is guaranteed to generate at least [0, 2^15) range, | 638 | * rand() is guaranteed to generate at least [0, 2^15) range, |
| 643 | * but lowest bits in some libc are not so "random". */ | 639 | * but lowest bits in some libc are not so "random". |
| 640 | */ | ||
| 644 | srand(monotonic_us()); /* pulls in printf */ | 641 | srand(monotonic_us()); /* pulls in printf */ |
| 645 | pid = getpid(); | 642 | pid = getpid(); |
| 646 | while (1) { | 643 | while (1) { |
