From 893389b01d4246a5752bc06231decb01bf144103 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sun, 21 May 2023 09:25:19 +0200 Subject: [PATCH] hier_psprint_mtime(): fix wrong mtime calculation for (non existent file) generators --- src/spice_netlist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/spice_netlist.c b/src/spice_netlist.c index a053bacc..482643d0 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -26,13 +26,15 @@ static Str_hashtable model_table = {NULL, 0}; /* safe even with multiple schemat static const char *hier_psprint_mtime(const char *file_name) { - static char date[200] = ""; + static char date[200]; struct stat time_buf; struct tm *tm; + my_strncpy(date, "xxxxxxxx_xxxxxx", S(date)); if(!stat(file_name , &time_buf)) { tm=localtime(&(time_buf.st_mtime) ); strftime(date, sizeof(date), "%Y%m%d_%H%M%S", tm); } + dbg(1, "hier_psprint_mtime(): file_name=%s, date=%s\n", file_name, date); return date; }