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`.fsdg20230625
parent
3d01cf28d6
commit
960af2d6e8
|
@ -258,6 +258,8 @@ rhex(void)
|
|||
warn("%s", "/dev/urandom");
|
||||
return 16;
|
||||
}
|
||||
if ((errno != 0))
|
||||
return 16;
|
||||
}
|
||||
|
||||
return rbuf[rindex++] & 0xf;
|
||||
|
|
Loading…
Reference in New Issue