diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2026-02-21 13:19:25 +0100 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2026-02-21 13:19:25 +0100 |
| commit | a66d5b90db496208d8fd2aa022fa935285a0b9a9 (patch) | |
| tree | aa40637b79b2810e2af6f28127ffced1bf155b34 /src/app.c | |
| parent | 1b19afaa339f2f68520d61b634600ddeb04effb7 (diff) | |
Simplify some of teh html
Diffstat (limited to 'src/app.c')
| -rw-r--r-- | src/app.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } |
