summaryrefslogtreecommitdiff
path: root/test/librandom.c
blob: d11ba232d91c05b064ec3da63f1363da070b40c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#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);
  }
}