summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r--util/nvmutil/nvmutil.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index d047e2aa..fcdab9e8 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -140,10 +140,9 @@ rhex(void)
{
static int rfd = -1, n = 0;
static uint8_t rnum[16];
- if (!n) {
- xopen(rfd, "/dev/urandom", O_RDONLY);
+ xopen(rfd, "/dev/urandom", O_RDONLY);
+ if (!n)
xpread(rfd, (uint8_t *) &rnum, (n = 15) + 1, 0, "/dev/urandom");
- }
return rnum[n--] & 0xf;
}