]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix an ASSERT in bora/lib/misc/timeutil.c.
authorJohn Wolfe <jwolfe@vmware.com>
Thu, 20 May 2021 18:38:38 +0000 (11:38 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Thu, 20 May 2021 18:38:38 +0000 (11:38 -0700)
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.

open-vm-tools/lib/misc/timeutil.c

index 0793126f1cf1834b9aad24b54457942dec120d31..55d597788cce404c6df56d52019c838b931e48f3 100644 (file)
@@ -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;