Guard autoupdater more completely
This commit is contained in:
parent
76043c78b9
commit
a9a6ccb103
|
|
@ -17,28 +17,24 @@ is licensed under the GPLv2. Do not mingle code, please!
|
|||
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
void Sys_LaunchAutoupdater(int argc, char **argv)
|
||||
{
|
||||
#ifdef USE_AUTOUPDATER
|
||||
#ifdef _WIN32
|
||||
{
|
||||
/* We don't need the Unix pipe() tapdance here because Windows lets children wait on parent processes. */
|
||||
PROCESS_INFORMATION procinfo;
|
||||
STARTUPINFO startinfo;
|
||||
char cmdline[128];
|
||||
memset(&procinfo, '\0', sizeof (procinfo));
|
||||
memset(&startinfo, '\0', sizeof (startinfo));
|
||||
startinfo.cb = sizeof (startinfo);
|
||||
sprintf(cmdline, "" AUTOUPDATER_BIN " --waitpid %u", (unsigned int) GetCurrentProcessId());
|
||||
/* We don't need the Unix pipe() tapdance here because Windows lets children wait on parent processes. */
|
||||
PROCESS_INFORMATION procinfo;
|
||||
STARTUPINFO startinfo;
|
||||
char cmdline[128];
|
||||
memset(&procinfo, '\0', sizeof (procinfo));
|
||||
memset(&startinfo, '\0', sizeof (startinfo));
|
||||
startinfo.cb = sizeof (startinfo);
|
||||
sprintf(cmdline, "" AUTOUPDATER_BIN " --waitpid %u", (unsigned int) GetCurrentProcessId());
|
||||
|
||||
if (CreateProcessA(AUTOUPDATER_BIN, cmdline, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &startinfo, &procinfo))
|
||||
{
|
||||
/* close handles now so child cleans up immediately if nothing to do */
|
||||
CloseHandle(procinfo.hProcess);
|
||||
CloseHandle(procinfo.hThread);
|
||||
}
|
||||
if (CreateProcessA(AUTOUPDATER_BIN, cmdline, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &startinfo, &procinfo))
|
||||
{
|
||||
/* close handles now so child cleans up immediately if nothing to do */
|
||||
CloseHandle(procinfo.hProcess);
|
||||
CloseHandle(procinfo.hThread);
|
||||
}
|
||||
#else
|
||||
int updater_pipes[2];
|
||||
|
|
@ -79,8 +75,6 @@ void Sys_LaunchAutoupdater(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
(void) argc; (void) argv; /* possibly unused. Pacify compilers. */
|
||||
}
|
||||
|
||||
#endif /* USE_AUTOUPDATER */
|
||||
|
|
|
|||
|
|
@ -73,3 +73,7 @@ qboolean Sys_OpenFolderInPlatformFileManager( const char *path );
|
|||
#ifdef PROTOCOL_HANDLER
|
||||
char *Sys_ParseProtocolUri( const char *uri );
|
||||
#endif
|
||||
|
||||
#ifdef USE_AUTOUPDATER
|
||||
void Sys_LaunchAutoupdater(int argc, char **argv);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -790,8 +790,9 @@ int main( int argc, char **argv )
|
|||
char *protocolCommand = NULL;
|
||||
#endif
|
||||
|
||||
extern void Sys_LaunchAutoupdater(int argc, char **argv);
|
||||
#ifdef USE_AUTOUPDATER
|
||||
Sys_LaunchAutoupdater(argc, argv);
|
||||
#endif
|
||||
|
||||
#ifndef DEDICATED
|
||||
// SDL version check
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user