From f8ddb6ef8439a2f5c185ab96dcb412b8dfb04cbb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 9 Mar 2026 21:02:33 +0000 Subject: util/nvmutil: fix EINTR detection on urandom read i forgot to handle it in the previous refactor not really a problem in practise, since the first read probably succeeds anyway. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 3bae308f..8a2d6ef0 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -992,10 +992,17 @@ read_dev_urandom(int fd, void *buf, size_t len) for (retry = 0; retry < MAX_RETRY_RW; retry++) { rval = read(fd, buf, len); - if (rval && (size_t)rval <= len) { - errno = 0; - return rval; + if (rval == -1) { + if (errno == EINTR) + continue; + err(errno, "%s", rname); } + + if (!rval || (size_t)rval > len) + continue; + + errno = 0; + return rval; } err(EINTR, "%s: read: max retries exceeded: %s", rname); @@ -1228,7 +1235,7 @@ write_gbe_file_part(size_t p) if (rval != -1) err(ECANCELED, - "%s: Short pwrite, %zd bytes", + "%s: Short pwrite of %zd bytes", fname, rval); if (errno != EINTR) -- cgit v1.2.1