android/utils/filelock.c: Handle stale Win32 lock directories.

Win32 and other platforms do not use the same implementation of
file locks (due to platform differences), in particular, Win32
creates ....file.lock as a directory, while Unix creates it
as a single file.

If someone starts an emulator instance under Wine, which crashes,
the stale directory lock make another non-Wine emulator instance,
to enter an infinite loop.

These conditions are pretty difficult to obtain, but it's not
so unusual to get there during emulator development / testing.

This patch detects this edge case and prints a warning, failing
to lock the file, which allows the new emulator instance to
proceed (even if the locking fails).

Change-Id: Iae99be629020e95b2f57b0c10ab0e1317fdca2f5
1 file changed