neocgit

a more 'modern' version of cgit
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/neocgit

commit ad006918a570da32457461a5e59289b611d9a732
parent 35b3c67ac285f0c488b0d3042a1bbc44ef4f1f67
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Fri,  9 Oct 2015 11:01:04 +0200

Avoid use of non-reentrant functions

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Diffstat:
Mshared.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/shared.c b/shared.c @@ -563,7 +563,7 @@ char *expand_macros(const char *txt) char *get_mimetype_for_filename(const char *filename) { - char *ext, *mimetype, *token, line[1024]; + char *ext, *mimetype, *token, line[1024], *saveptr; FILE *file; struct string_list_item *mime; @@ -588,8 +588,8 @@ char *get_mimetype_for_filename(const char *filename) while (fgets(line, sizeof(line), file)) { if (!line[0] || line[0] == '#') continue; - mimetype = strtok(line, " \t\r\n"); - while ((token = strtok(NULL, " \t\r\n"))) { + mimetype = strtok_r(line, " \t\r\n", &saveptr); + while ((token = strtok_r(NULL, " \t\r\n", &saveptr))) { if (!strcasecmp(ext, token)) { fclose(file); return xstrdup(mimetype);