From 1184dcb05c9923936c121ee2ad61ea966bc562ea Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 12 Mar 2026 13:20:10 +0000 Subject: util/nvmutil: disable urandom if not found disable random mac address generation on really old operating systems. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index a8d97d09..475e0a7e 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -718,13 +718,8 @@ open_dev_urandom(void) if (urandom_fd != -1) return; - fprintf(stderr, "Can't open %s (will use %s instead)\n", - newrandom, oldrandom); - rname = oldrandom; urandom_fd = open(rname, O_RDONLY | O_BINARY | O_NONBLOCK); - if (urandom_fd == -1) - err(errno, "%s: could not open", rname); } static void @@ -1001,6 +996,9 @@ rhex(void) static size_t n = 0; static uint8_t rnum[12]; + if (urandom_fd) + err(ECANCELED, "Your operating system has no /dev/[u]random"); + if (!n) { n = sizeof(rnum); if (rw_file_exact(urandom_fd, rnum, n, 0, LESEN) == -1) -- cgit v1.2.1