diff options
author | Thomas Haller <thaller@redhat.com> | 2023-08-18 11:36:11 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-08-18 12:06:20 (GMT) |
commit | be5add72bd0c86053561882efda33f40b804e435 (patch) | |
tree | eeca04ccf1d76d6a01d0f023c27f6128a8695a5f /lib | |
parent | 40578a6299adde3c55e46423e8dbb0e8448c76ad (diff) | |
download | libnl-be5add72bd0c86053561882efda33f40b804e435.zip libnl-be5add72bd0c86053561882efda33f40b804e435.tar.gz libnl-be5add72bd0c86053561882efda33f40b804e435.tar.bz2 |
tests: avoid srandom()/random() in favor of _nltst_rand_u32()
srandom() and random() are a code smell, because they are not thread safe.
Avoid its usage, even if this was only for testing. Even in testing code,
we don't want to find those functions and have to reason why they are fine
for testing. Just don't.
Arguably, _nltst_rand_u32() calls jrand48(), which (in glibc) is
possibly not thread-safe either. But that is only one place for
investigation, instead of 3.
Also, _nltst_rand_u32() honors NLTST_SEED_RAND to generate a
reproducible sequence of random numbers.
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions