From: VMware, Inc <> Date: Thu, 22 Dec 2011 00:07:28 +0000 (-0800) Subject: lib/lock: Add formal fallback code X-Git-Tag: 2011.12.20-562307~57 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb51ae6c340631603547ab641fbef9b594ee41c0;p=thirdparty%2Fopen-vm-tools.git lib/lock: Add formal fallback code Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/lock/ul.c b/open-vm-tools/lib/lock/ul.c index 0014eb38a..5c4c4e397 100644 --- a/open-vm-tools/lib/lock/ul.c +++ b/open-vm-tools/lib/lock/ul.c @@ -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 */