Add a missing check for the struct timeval pointer being NULL.
Reported-by: 109224573 <109224573@qq.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- Fix the problem that VMIN and VTIME does not work at all in console.
- Fix a bug that cannot handle consoles more than 32, rather than 64.
+
+- Fix gettimeofday not checking for a NULL pointer
+ Addresses: https://cygwin.com/pipermail/cygwin/2024-February/255473.html
static bool tzflag;
LONGLONG now = get_clock (CLOCK_REALTIME)->usecs ();
- tv->tv_sec = now / USPERSEC;
- tv->tv_usec = now % USPERSEC;
+ if (tv)
+ {
+ tv->tv_sec = now / USPERSEC;
+ tv->tv_usec = now % USPERSEC;
+ }
- if (tz != NULL)
+ if (tz)
{
if (!tzflag)
{