From: Felix Fietkau Date: Mon, 20 Nov 2023 22:01:59 +0000 (+0100) Subject: ring: add missing fread return code check X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=759d9404034b7da97b3950c806ace7296a0f7a12;p=project%2Fudebug.git ring: add missing fread return code check Fixes build issue with glibc Signed-off-by: Felix Fietkau --- diff --git a/ring.c b/ring.c index ba75ac5..8a7e27f 100644 --- a/ring.c +++ b/ring.c @@ -22,7 +22,8 @@ static uint32_t gen_ring_id(void) if (!urandom && (urandom = fopen("/dev/urandom", "r")) == NULL) return 0; - fread(&val, sizeof(val), 1, urandom); + if (fread(&val, sizeof(val), 1, urandom) != 1) + return 0; return val; }