fix the file descriptor without determining null

This commit is contained in:
mark0
2023-07-28 17:32:59 +08:00
parent 705cdf45fc
commit bd1648e707
3 changed files with 3 additions and 0 deletions

View File

@ -67,6 +67,7 @@ static void test_rand_below(void **state) {
rand_set_seed(&afl, 1337);
afl.fsrv.dev_urandom_fd = open("/dev/urandom", O_RDONLY);
if (afl.fsrv.dev_urandom_fd < 0) { PFATAL("Unable to open /dev/urandom"); }
assert(!(rand_below(&afl, 9000) > 9000));
assert_int_equal(rand_below(&afl, 1), 0);