mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-24 21:08:56 +02:00
util/nvmutil: re-try /dev/[u]random on EAGAIN
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+20
-2
@@ -1121,8 +1121,26 @@ cmd_helper_cat(void)
|
|||||||
static void
|
static void
|
||||||
gbe_cat_buf(uint8_t *b)
|
gbe_cat_buf(uint8_t *b)
|
||||||
{
|
{
|
||||||
if (rw_file_exact(STDOUT_FILENO, b, GBE_PART_SIZE, 0, SCHREIB) == -1)
|
ssize_t rval;
|
||||||
err(errno, "cat");
|
|
||||||
|
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
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user