Replaced some thread un-safe functions with their safe counterparts

This commit is contained in:
2014-08-06 22:29:28 +01:00
parent a998a32f31
commit 40c29b190b
8 changed files with 25 additions and 13 deletions

View File

@@ -262,11 +262,13 @@ FILE * server_generate_directory_index(config_host *hconfig, const char* dirpath
}
time_t file_mtime = (time_t)filestat->st_mtim.tv_sec;
char* file_mod_time = ctime(&file_mtime);
char* file_mod_time = calloc(32, sizeof(char));
ctime_r(&file_mtime, file_mod_time);
utstring_printf(index, "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\r\n", uri,
(filesize!=NULL)?filesize:"N/A",
(file_mod_time!=NULL)?file_mod_time:"N/A");
free(file_mod_time);
free(filepath);
free(filesize);
free(uri);