mirror of
https://git.sr.ht/~sircmpwn/gmnisrv
synced 2025-02-02 15:08:11 -05:00
Fail gracefully if mime database is not present
This commit is contained in:
parent
077b96d3cc
commit
a26573251b
@ -1,4 +1,5 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@ -29,7 +30,12 @@ mime_init()
|
||||
mimedb = malloc(mimedb_sz * sizeof(struct mime_info));
|
||||
|
||||
FILE *f = fopen(MIMEDB, "r");
|
||||
assert(f);
|
||||
if (!f) {
|
||||
fprintf(stderr, "Unable to open MIME database for reading: %s\n",
|
||||
strerror(errno));
|
||||
fprintf(stderr, "Is " MIMEDB " installed?\n");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
char *line = NULL;
|
||||
size_t n = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user