bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Infinite recusion in test-timespec_getres.exe


From: Gisle Vanem
Subject: Infinite recusion in test-timespec_getres.exe
Date: Thu, 30 Dec 2021 16:48:03 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Trying the new test 'test-timespec_getres.exe'
gave me a "Stack overflow - code c00000fd (first chance)"
since in my case here on Windows/MSVC, the function really is:

long int gettime_res (void)
{
  struct rpl_timespec res;
  timespec_getres (&res, 1);
  ....

and then 'timespec_getres()' calls 'getime_res()'
again!

I fixed it by:

--- a/lib/gettime-res.c 2021-12-30 15:27:18
+++ b/lib/gettime-res.c                   2021-12-30 16:42:14
@@ -41,7 +41,7 @@
   struct timespec res;
 #if defined CLOCK_REALTIME && HAVE_CLOCK_GETRES
   clock_getres (CLOCK_REALTIME, &res);
-#elif defined HAVE_TIMESPEC_GETRES
+#elif defined HAVE_TIMESPEC_GETRES && HAVE_TIMESPEC_GETRES
   timespec_getres (&res, TIME_UTC);
 #else
   /* Guess high and let the later code deduce better.  */

----

I have '#define HAVE_TIMESPEC_GETRES 0' here obviously.

--
--gv



reply via email to

[Prev in Thread] Current Thread [Next in Thread]