From 8d59c9302f0fad49f6d8573f4015c1cc9f627242 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Mon, 29 Jan 2024 07:52:56 -0600 Subject: [PATCH] Change test_2038 routine to return error on time_t size==4 Seems ctime might be seg faulting on the test https://github.com/Hamlib/Hamlib/issues/1492 --- src/misc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/misc.c b/src/misc.c index 4b9daa790..9cdfd041c 100644 --- a/src/misc.c +++ b/src/misc.c @@ -3048,6 +3048,13 @@ int rig_test_2038(RIG *rig) time_t x; rig_debug(RIG_DEBUG_TRACE, "%s: enter\n", __func__); + + if (sizeof(time_t) == 4) + { + rig_debug(RIG_DEBUG_TRACE, "%s: ctime is null, 2038 test failed\n", __func__); + return 0; + } + x = (time_t)((1U << 31) - 1); char *s = ctime(&x); @@ -3056,6 +3063,7 @@ int rig_test_2038(RIG *rig) rig_debug(RIG_DEBUG_TRACE, "%s: ctime is null, 2038 test failed\n", __func__); return 1; } + if (!strstr(s, "2038")) { return 1; } x += 1;