]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: Add formal fallback code
authorVMware, Inc <>
Thu, 22 Dec 2011 00:07:28 +0000 (16:07 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 22 Dec 2011 00:07:28 +0000 (16:07 -0800)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/lock/ul.c

index 0014eb38a1c6c2f5281e390578c165aead374833..5c4c4e3973000a1be7485df52d518f2bf1aa2f45 100644 (file)
@@ -124,16 +124,6 @@ MXUserSyndrome(void)
    syndrome = Atomic_Read(&syndromeMem);
 
    if (syndrome == 0) {
-#if defined(VMX86_SERVER)
-      /*
-       * On ESX Random_Crypto may hang (PR 787027). Ask for the time, in
-       * seconds since the epoch.
-       *
-       * XXX PR filed to get ESX to fix this.
-       */
-
-      syndrome = time(NULL) & 0xFFFFFFFF;
-#else
       uint32 retries = 25;
 
       /*
@@ -151,15 +141,24 @@ MXUserSyndrome(void)
             break;
          }
       } while (retries--);
-#endif
 
       /*
        * If the source was unable to provide the appropriate bits, switch
        * to plan B.
        */
 
+#if defined(_WIN32)
+      syndrome = GetTickCount();
+#else
+      syndrome = time(NULL) & 0xFFFFFFFF;
+#endif
+
+      /*
+       * Protect against a total failure.
+       */
+
       if (syndrome == 0) {
-         syndrome++;  // Fudge in case of failure
+         syndrome++;
       }
 
       /* blind write; if racing one thread or the other will do */