X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/fbbe300f4d52ab014fb09050deea7746b1d02a82..e20b50112e01f92f7c302107b59b17d8cc28387a:/components/entropy.c?ds=inline diff --git a/components/entropy.c b/components/entropy.c index ac61679..5173f15 100644 --- a/components/entropy.c +++ b/components/entropy.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #if defined(__linux__) + #include #include #include "../util.h" @@ -7,11 +8,14 @@ const char * entropy(void) { - int num; + uintmax_t num; - return (pscanf("/proc/sys/kernel/random/entropy_avail", - "%d", &num) == 1) ? - bprintf("%d", num) : NULL; + if (pscanf("/proc/sys/kernel/random/entropy_avail", + "%" PRIuMAX, &num) != 1) { + return NULL; + } + + return bprintf("%" PRIuMAX, num); } #elif defined(__OpenBSD__) const char *