util/nvmutil: re-try /dev/[u]random on EAGAIN

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-10 15:12:12 +00:00
parent b291bbf2e5
commit 1f953359cb
+20 -2
View File
@@ -1121,8 +1121,26 @@ cmd_helper_cat(void)
static void
gbe_cat_buf(uint8_t *b)
{
if (rw_file_exact(STDOUT_FILENO, b, GBE_PART_SIZE, 0, SCHREIB) == -1)
err(errno, "cat");
ssize_t rval;
while (1) {
rval = rw_file_exact(STDOUT_FILENO, b,
GBE_PART_SIZE, 0, SCHREIB);
if (rval == -1) {
if (errno == EAGAIN) {
errno = 0;
continue;
}
err(errno, "%s: cat", rname);
}
if ((size_t)rval != GBE_PART_SIZE)
err(errno, "%s: Partial read", rname);
break;
}
}
static void