summaryrefslogtreecommitdiffhomepage
path: root/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'random.c')
-rw-r--r--random.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/random.c b/random.c
index c5a522e..17e3086 100644
--- a/random.c
+++ b/random.c
@@ -158,6 +158,9 @@ static void write_urandom()
/* This is opportunistic, don't worry about failure */
unsigned char buf[INIT_SEED_SIZE];
FILE *f = fopen(DROPBEAR_URANDOM_DEV, "w");
+ if (!f) {
+ return;
+ }
genrandom(buf, sizeof(buf));
fwrite(buf, sizeof(buf), 1, f);
fclose(f);