summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/app.c b/src/app.c
index 9d1ee7a..976d51e 100644
--- a/src/app.c
+++ b/src/app.c
@@ -21,16 +21,19 @@ static void sqliteError(void *pArg, int iErrCode, const char *zMsg) {
static int generate_secret(char *out) {
unsigned char bytes[16];
int fd = open("/dev/urandom", O_RDONLY);
- if (fd < 0) return -1;
+ if (fd < 0) abort();
ssize_t n = read(fd, bytes, 16);
close(fd);
- if (n != 16) return -1;
+
+ if (n != 16) abort();
+
static const char hex[] = "0123456789abcdef";
for (int i = 0; i < 16; i++) {
out[i*2] = hex[(bytes[i] >> 4) & 0x0f];
out[i*2+1] = hex[bytes[i] & 0x0f];
}
out[32] = '\0';
+
return 0;
}