Skip to content
Snippets Groups Projects
Commit 960af2d6 authored by Leah Rowe's avatar Leah Rowe
Browse files

util/nvmutil: rhex(): fail if errno not zero

The code was only checking whether all of the bytes were read,
but there are other errors that can be caught via errno.

Enforce strict errno handling, when generating random
numbers for command `setmac`.
parent 3d01cf28
Branches
Tags
No related merge requests found
......@@ -258,6 +258,8 @@ rhex(void)
warn("%s", "/dev/urandom");
return 16;
}
if ((errno != 0))
return 16;
}
return rbuf[rindex++] & 0xf;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment