# HG changeset patch # User John Tsiombikas # Date 1429382167 -10800 # Node ID 0244b08cc9d3ffb76a12ecb3e6f0c9b8beb0293b # Parent 121b991ccc1d7a6743039843e4897ca62fb4f68c fixed the mime-type bug diff -r 121b991ccc1d -r 0244b08cc9d3 src/main.c --- a/src/main.c Fri Apr 17 12:02:59 2015 +0300 +++ b/src/main.c Sat Apr 18 21:36:07 2015 +0300 @@ -21,7 +21,9 @@ signal(SIGTERM, sighandler); signal(SIGQUIT, sighandler); - tw_start(); + if(tw_start() == -1) { + return 1; + } for(;;) { int i; diff -r 121b991ccc1d -r 0244b08cc9d3 src/mime.c --- a/src/mime.c Fri Apr 17 12:02:59 2015 +0300 +++ b/src/mime.c Sat Apr 18 21:36:07 2015 +0300 @@ -17,8 +17,7 @@ {"jpeg", "image/jpeg"}, {"gif", "image/gif"}, {"bmp", "image/bmp"}, - {"cgi", 0} -, + {"cgi", 0}, {0, 0} }; @@ -33,7 +32,7 @@ if(types) return 0; - if((types = rb_create(RB_KEY_STRING))) { + if(!(types = rb_create(RB_KEY_STRING))) { return -1; } rb_set_delete_func(types, del_func, 0); @@ -54,7 +53,7 @@ { init_types(); - return rb_insert(types, strdup(suffix), strdup(type)); + return rb_insert(types, strdup(suffix), type ? strdup(type) : 0); } const char *mime_type(const char *path)