From: John Wolfe Date: Thu, 20 May 2021 18:38:38 +0000 (-0700) Subject: Fix an ASSERT in bora/lib/misc/timeutil.c. X-Git-Tag: stable-11.3.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95cbd990ec667a34b6b76c1d53182317c33e5330;p=thirdparty%2Fopen-vm-tools.git Fix an ASSERT in bora/lib/misc/timeutil.c. Fix a problem with TimeUtil_NtTimeToUnixTime on Arm that was encountered when running tools tests on Apple silicon. The problem was the routine assumed that a variable was 32-bits if VM_X86_64 was not defined. This may have been true in the past, but it is no longer true now that the code is also built for 64-bit Arm. --- diff --git a/open-vm-tools/lib/misc/timeutil.c b/open-vm-tools/lib/misc/timeutil.c index 0793126f1..55d597788 100644 --- a/open-vm-tools/lib/misc/timeutil.c +++ b/open-vm-tools/lib/misc/timeutil.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2020 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2021 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -893,8 +893,8 @@ int TimeUtil_NtTimeToUnixTime(struct timespec *unixTime, // OUT: Time in Unix format VmTimeType ntTime) // IN: Time in Windows NT format { -#ifndef VM_X86_64 ASSERT(unixTime); +#ifndef VM_64BIT /* We assume that time_t is 32bit */ ASSERT(sizeof (unixTime->tv_sec) == 4); @@ -905,9 +905,7 @@ TimeUtil_NtTimeToUnixTime(struct timespec *unixTime, // OUT: Time in Unix forma unixTime->tv_nsec = 0; return 1; } -#else - ASSERT(unixTime); -#endif // VM_X86_64 +#endif // ifndef VM_64BIT if (ntTime < UNIX_EPOCH) { unixTime->tv_sec = 0;