tinywebd
diff src/mime.c @ 9:0244b08cc9d3
fixed the mime-type bug
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 18 Apr 2015 21:36:07 +0300 |
parents | 5ec50ca0d071 |
children |
line diff
1.1 --- a/src/mime.c Fri Apr 17 12:02:59 2015 +0300 1.2 +++ b/src/mime.c Sat Apr 18 21:36:07 2015 +0300 1.3 @@ -17,8 +17,7 @@ 1.4 {"jpeg", "image/jpeg"}, 1.5 {"gif", "image/gif"}, 1.6 {"bmp", "image/bmp"}, 1.7 - {"cgi", 0} 1.8 -, 1.9 + {"cgi", 0}, 1.10 {0, 0} 1.11 }; 1.12 1.13 @@ -33,7 +32,7 @@ 1.14 1.15 if(types) return 0; 1.16 1.17 - if((types = rb_create(RB_KEY_STRING))) { 1.18 + if(!(types = rb_create(RB_KEY_STRING))) { 1.19 return -1; 1.20 } 1.21 rb_set_delete_func(types, del_func, 0); 1.22 @@ -54,7 +53,7 @@ 1.23 { 1.24 init_types(); 1.25 1.26 - return rb_insert(types, strdup(suffix), strdup(type)); 1.27 + return rb_insert(types, strdup(suffix), type ? strdup(type) : 0); 1.28 } 1.29 1.30 const char *mime_type(const char *path)