On Windows the second server will keep the old executable busy, preventing its deletion. So give up after a while. Usually the second server will be running with --set-time-only so upgrading it is not as important. If necessary this condition can be detected on the client by attempting to delete the old executable and checking for an error.
Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
Note: Patch 2 only depends on this one because this fix is mentionned in the comment describing version 1.8.
testbot/src/testagentd/platform_windows.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/testbot/src/testagentd/platform_windows.c b/testbot/src/testagentd/platform_windows.c index bb52a0241..0ba7d2cdf 100644 --- a/testbot/src/testagentd/platform_windows.c +++ b/testbot/src/testagentd/platform_windows.c @@ -532,17 +532,20 @@ int platform_init(void) { /* This also serves to ensure the old server has released the port * before we attempt to open our own. + * But if a second server is running the deletion will never work so + * give up after a while. */ + int attempt = 0; do { if (!DeleteFileA(oldtestagentd)) Sleep(500); + attempt++; } - while (GetLastError() == ERROR_ACCESS_DENIED); + while (GetLastError() == ERROR_ACCESS_DENIED && attempt < 20); free(oldtestagentd); }
- wVersionRequested = MAKEWORD(2, 2); rc = WSAStartup(wVersionRequested, &wsaData); if (rc)