summaryrefslogtreecommitdiffstats
path: root/src/random.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-20 05:29:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-20 05:29:11 +0200
commit7adeb6e88196a594ec3d36ffc1c658340ffcd7bc (patch)
tree6a6bfb84387141bf39d573ef9fa47f2c993d1923 /src/random.c
parentb9c8603931203f5d94091f7a05a5967304b62fbd (diff)
downloadfastd-7adeb6e88196a594ec3d36ffc1c658340ffcd7bc.tar
fastd-7adeb6e88196a594ec3d36ffc1c658340ffcd7bc.zip
Make ctx global
Diffstat (limited to 'src/random.c')
-rw-r--r--src/random.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/random.c b/src/random.c
index 9c7359f..ce7183b 100644
--- a/src/random.c
+++ b/src/random.c
@@ -30,7 +30,7 @@
#include <sys/stat.h>
-void fastd_random_bytes(fastd_context_t *ctx, void *buffer, size_t len, bool secure) {
+void fastd_random_bytes(void *buffer, size_t len, bool secure) {
int fd;
size_t read_bytes = 0;
@@ -40,7 +40,7 @@ void fastd_random_bytes(fastd_context_t *ctx, void *buffer, size_t len, bool sec
fd = open("/dev/urandom", O_RDONLY);
if (fd < 0)
- exit_errno(ctx, "unable to open random device");
+ exit_errno("unable to open random device");
while (read_bytes < len) {
ssize_t ret = read(fd, ((char*)buffer)+read_bytes, len-read_bytes);
@@ -49,7 +49,7 @@ void fastd_random_bytes(fastd_context_t *ctx, void *buffer, size_t len, bool sec
if (errno == EINTR)
continue;
- exit_errno(ctx, "unable to read from random device");
+ exit_errno("unable to read from random device");
}
read_bytes += ret;