From db204afc9c544053ec04dc6d744988ef10c57b05 Mon Sep 17 00:00:00 2001 From: meleu Date: Fri, 19 Aug 2016 16:31:13 -0300 Subject: [PATCH] changes based on the @Alcaro suggestions Suggestions made here: https://github.com/libretro/RetroArch/pull/3407 --- libretro-common/file/file_path.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index e9100d8cc0..2f2a7e772d 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -415,8 +415,7 @@ void fill_pathname_parent_dir(char *out_dir, void fill_dated_filename(char *out_filename, const char *ext, size_t size) { - time_t cur_time; - time(&cur_time); + time_t cur_time = time(NULL); strftime(out_filename, size, "RetroArch-%m%d-%H%M%S.", localtime(&cur_time)); @@ -440,11 +439,10 @@ void fill_str_dated_filename(char *out_filename, const char *in_str, const char *ext, size_t size) { char format[256] = {0}; - time_t cur_time; - time(&cur_time); + time_t cur_time = time(NULL); - strncpy(out_filename, in_str, size); strftime(format, sizeof(format), "-%y%m%d-%H%M%S.", localtime(&cur_time)); + strlcpy(out_filename, in_str, size); strlcat(out_filename, format, size); strlcat(out_filename, ext, size); }