mirror of
https://github.com/wolfcw/libfaketime.git
synced 2026-05-17 08:36:28 +03:00
Running "make randomtest" should demonstrates the segfault described in https://github.com/wolfcw/libfaketime/issues/295
18 lines
401 B
C
18 lines
401 B
C
#include <stdio.h>
|
|
#include <sys/random.h>
|
|
|
|
void func() {
|
|
fprintf(stderr, " called func()\n");
|
|
}
|
|
|
|
|
|
static __attribute__((constructor)) void rnd_init() {
|
|
unsigned int targ;
|
|
ssize_t ret = getrandom(&targ, sizeof(targ), 0);
|
|
if (ret == sizeof(targ)) {
|
|
fprintf(stderr, " getrandom() yielded 0x%08x\n", targ);
|
|
} else {
|
|
fprintf(stderr, " getrandom() failed with only %zd\n", ret);
|
|
}
|
|
}
|