3 * Copyright 2004, Clemens Fruhwirth <clemens@endorphin.org>
14 static int randomfd = -1;
18 randomfd = open("/dev/urandom", O_RDONLY);
22 /* This method leaks a file descriptor that can be obtained by calling
24 int getRandom(char *buf, size_t len)
28 if(openRandom() == -1) {
34 r = read(randomfd,buf,len);
35 if (-1 == r && errno != -EINTR) {
36 perror("read: "); return -EINVAL;