summaryrefslogtreecommitdiff
path: root/uclient-http.c
diff options
context:
space:
mode:
Diffstat (limited to 'uclient-http.c')
-rw-r--r--uclient-http.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/uclient-http.c b/uclient-http.c
index 8d26bd4..ac9d50f 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -379,11 +379,14 @@ get_cnonce(char *dest)
{
uint32_t val = 0;
FILE *f;
+ size_t n;
f = fopen("/dev/urandom", "r");
if (f) {
- fread(&val, sizeof(val), 1, f);
+ n = fread(&val, sizeof(val), 1, f);
fclose(f);
+ if (n != 1)
+ return;
}
bin_to_hex(dest, &val, sizeof(val));