pw: reinitialize struct tm before every call to strptime

This prevents corrupted result due to leftover of previous failed
call to strptime
This commit is contained in:
Baptiste Daroussin 2022-06-07 22:28:13 +02:00
parent 30c85a085e
commit 0a9541d9f3

View File

@ -128,8 +128,8 @@ parse_datesub(char const * str, struct tm *t)
l = newlocale(LC_ALL_MASK, "C", NULL);
memset(&tm, 0, sizeof(tm));
for (i=0; valid_formats[i] != NULL; i++) {
memset(&tm, 0, sizeof(tm));
ret = strptime_l(str, valid_formats[i], &tm, l);
if (ret && *ret == '\0') {
t->tm_mday = tm.tm_mday;