mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-24 02:04:02 +02:00
lbutils, rset: err if zero bytes requested
similar to the logic about other failure states Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -64,6 +64,10 @@ rset(void *buf, size_t n)
|
|||||||
if (if_err(buf == NULL, EFAULT))
|
if (if_err(buf == NULL, EFAULT))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
if (n == 0)
|
||||||
|
err_no_cleanup(0, EPERM,
|
||||||
|
"rset: zero-byte length request");
|
||||||
|
|
||||||
#if (defined(__OpenBSD__) || defined(__FreeBSD__) || \
|
#if (defined(__OpenBSD__) || defined(__FreeBSD__) || \
|
||||||
defined(__NetBSD__) || defined(__APPLE__) || \
|
defined(__NetBSD__) || defined(__APPLE__) || \
|
||||||
defined(__DragonFly__)) && !(defined(USE_URANDOM) && \
|
defined(__DragonFly__)) && !(defined(USE_URANDOM) && \
|
||||||
@@ -113,7 +117,7 @@ out:
|
|||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
return;
|
return;
|
||||||
err:
|
err:
|
||||||
err_no_cleanup(1, ECANCELED,
|
err_no_cleanup(0, ECANCELED,
|
||||||
"Randomisation failure, possibly unsupported in your kernel");
|
"Randomisation failure, possibly unsupported in your kernel");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user