summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2023-04-15 21:08:27 +0300
committerArnold D. Robbins <arnold@skeeve.com>2023-04-15 21:08:27 +0300
commit10f8bb08480ab15f21ba496caf9d87f8b33c0bb6 (patch)
treedd41d762dc7a452a5f89e30ed940f39ae6a77119
parent0a5f1a1386d85e71d7e44fa1ed94d6fde4e02a00 (diff)
downloadgawk-10f8bb08480ab15f21ba496caf9d87f8b33c0bb6.tar.gz
Portability fix in missing_d/strptime.c.
-rw-r--r--missing_d/ChangeLog6
-rw-r--r--missing_d/strptime.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog
index b01a6535..9607a336 100644
--- a/missing_d/ChangeLog
+++ b/missing_d/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * strptime.c (strptime_internal): Rework a bit to use localtime()
+ instead of localtime_r(). This lets it work for MinGW and maybe
+ other systems. Thanks to Eli Zaretskii <eliz@gnu.org> for the report.
+
2023-03-12 Arnold D. Robbins <arnold@skeeve.com>
* strptime.c: New file, from GNULIB, with a few slight mods.
diff --git a/missing_d/strptime.c b/missing_d/strptime.c
index 670c5320..5e87f618 100644
--- a/missing_d/strptime.c
+++ b/missing_d/strptime.c
@@ -571,6 +571,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
character for character and construct the result while
doing this. */
time_t secs = 0;
+ struct tm *then;
if (*rp < '0' || *rp > '9')
/* We need at least one digit. */
return NULL;
@@ -582,9 +583,11 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
}
while (*rp >= '0' && *rp <= '9');
- if (localtime_r (&secs, tm) == NULL)
+ if ((then = localtime (&secs)) == NULL)
/* Error in function. */
return NULL;
+ else
+ *tm = *then;
}
break;
case 'S':