Files
libfaketime/test/snippets/getrandom.c
Daniel Kahn Gillmor 17522c5ba1 Overhaul testing library constructors
We want to make it easier to test a bunch of different functions that
might be invoked in constructors of other libraries.

It seems conceivable that with these snippets, we could design other
tests that also work across a wide range of intercepted functions.
2021-02-25 23:17:25 -05:00

8 lines
231 B
C

unsigned int targ;
ssize_t ret = getrandom(&targ, sizeof(targ), 0);
if (ret == sizeof(targ)) {
printf("[%s] getrandom() yielded 0x%08x\n", where, targ);
} else {
printf("[%s] getrandom() failed with only %zd\n", where, ret);
}