diff randombytes.c @ 9:765303f4f2da

Attempt to fix randombytes.c for unpatched NaCl
author Ivo Smits <Ivo@UCIS.nl>
date Thu, 14 Jul 2011 16:49:21 +0200
parents a139bed53614
children
line wrap: on
line diff
--- a/randombytes.c	Thu Jul 14 16:32:23 2011 +0200
+++ b/randombytes.c	Thu Jul 14 16:49:21 2011 +0200
@@ -1,8 +1,8 @@
 #include <time.h>
 
 void randombytes(unsigned char *x,unsigned long long xlen) {
-	int fd = open("/dev/urandom",O_RDONLY);
-	if (fd != -1) {
+	FILE* fd = fopen("/dev/urandom", "rb");
+	if (fd != NULL) {
 		fread(x, 1, xlen, fd);
 		fclose(fd);
 	} else {