summaryrefslogtreecommitdiff
path: root/cpio
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2022-12-20 04:48:42 -0800
committerGitHub <noreply@github.com>2022-12-20 13:48:42 +0100
commit2d329073435d36065ce30bfd29428f6a45e41016 (patch)
tree66cf347dc278eb7a86ac02dfabb8858d8fd69538 /cpio
parent3da2fb7ee2d929bc8f02bcf3d42def768667c939 (diff)
downloadlibarchive-2d329073435d36065ce30bfd29428f6a45e41016.tar.gz
cleanup _localtime64_s (#1820)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'cpio')
-rw-r--r--cpio/cpio.c6
-rw-r--r--cpio/test/test_option_t.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/cpio/cpio.c b/cpio/cpio.c
index 68a6301a..4acab9d2 100644
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -1205,15 +1205,15 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
else
fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M";
#endif
-#if defined(HAVE_LOCALTIME_R)
- ltime = localtime_r(&mtime, &tmbuf);
-#elif defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE__LOCALTIME64_S)
tmptime = mtime;
terr = _localtime64_s(&tmbuf, &tmptime);
if (terr)
ltime = NULL;
else
ltime = &tmbuf;
+#elif defined(HAVE_LOCALTIME_R)
+ ltime = localtime_r(&mtime, &tmbuf);
#else
ltime = localtime(&mtime);
#endif
diff --git a/cpio/test/test_option_t.c b/cpio/test/test_option_t.c
index 0f2dda27..3d27b72d 100644
--- a/cpio/test/test_option_t.c
+++ b/cpio/test/test_option_t.c
@@ -95,15 +95,15 @@ DEFINE_TEST(test_option_t)
#ifdef HAVE_LOCALE_H
setlocale(LC_ALL, "");
#endif
-#if defined(HAVE_LOCALTIME_R)
- tmptr = localtime_r(&mtime, &tmbuf);
-#elif defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE__LOCALTIME64_S)
tmptime = mtime;
terr = _localtime64_s(&tmbuf, &tmptime);
if (terr)
tmptr = NULL;
else
tmptr = &tmbuf;
+#elif defined(HAVE_LOCALTIME_R)
+ tmptr = localtime_r(&mtime, &tmbuf);
#else
tmptr = localtime(&mtime);
#endif