From cd4aa2d9a9cffc5e600bbccc152397c8d5f744cc Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 2 Jun 2017 01:32:33 -0400 Subject: [PATCH] Don't fail if the game process went away before we were ready to wait for it. --- code/autoupdater/autoupdater.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/autoupdater/autoupdater.c b/code/autoupdater/autoupdater.c index 3a2d17b0..7c0cebaa 100644 --- a/code/autoupdater/autoupdater.c +++ b/code/autoupdater/autoupdater.c @@ -189,7 +189,12 @@ static void windowsWaitForProcessToDie(const DWORD pid) infof("Waiting on process ID #%u", (unsigned int) pid); h = OpenProcess(SYNCHRONIZE, FALSE, pid); if (!h) { -// !!! FIXME: what does this return if process is already dead? + const DWORD err = GetLastError(); + if (err == ERROR_INVALID_PARAMETER) { + info("No such process; probably already dead. Carry on."); + return; /* process is (probably) already gone. */ + } + infof("OpenProcess failed. err=%d", (unsigned int) err); die("OpenProcess failed"); } if (WaitForSingleObject(h, INFINITE) != WAIT_OBJECT_0) {