summaryrefslogtreecommitdiff
path: root/src/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/random.c')
-rw-r--r--src/random.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/random.c b/src/random.c
index 648ec9f..2f9f731 100644
--- a/src/random.c
+++ b/src/random.c
@@ -18,30 +18,31 @@ int
urandom_bytes(const size_t n, uint8_t (*const addr)[]) {
int rc = -1;
+ // FIXME: rename ret
uint8_t *temp = NULL;
FILE *f = NULL;
temp = malloc(n);
if (temp == NULL) {
- logerr("malloc(...): %s\n", strerror(errno));
+ logerr("malloc(): %s", strerror(errno));
goto out;
}
f = fopen("/dev/urandom", "r");
if (f == NULL) {
- logerr("fopen(...): %s\n", strerror(errno));
+ logerr("fopen(): %s", strerror(errno));
goto out;
}
const size_t read_count = fread(temp, 1, n, f);
if (ferror(f)) {
- logerr("fread(...), n, f): %s\n", strerror(errno));
+ logerr("fread(): %s", strerror(errno));
goto out;
}
assert(read_count == n);
if (fclose(f)) {
- logerr("fclose(...): %s\n", strerror(errno));
+ logerr("fclose(): %s", strerror(errno));
goto out;
}
f = NULL;
@@ -51,7 +52,7 @@ urandom_bytes(const size_t n, uint8_t (*const addr)[]) {
out:
if (f != NULL) {
if (fclose(f)) {
- logerr("fclose(...): %s\n", strerror(errno));
+ logerr("fclose(): %s", strerror(errno));
rc = -1;
}
}