ditch explicit close command; just close the handle
This commit is contained in:
@@ -247,27 +247,22 @@ void RunChild()
|
||||
WriteToChild( hToStdin, p, iSize );
|
||||
|
||||
/* The parent process needs to access this process briefly. When it's done, it'll
|
||||
* write a byte to stdout. Wait until we see that before exiting. */
|
||||
* close the handle. Wait until we see that before exiting. */
|
||||
while(1)
|
||||
{
|
||||
int iCmd;
|
||||
DWORD iActual;
|
||||
if( !ReadFile(hFromStdout, &iCmd, sizeof(iCmd), &iActual, NULL) )
|
||||
break;
|
||||
|
||||
/* Ugly: the new process can't execute GetModuleFileName on this process,
|
||||
* since GetModuleFileNameEx might not be available. Run the requests here. */
|
||||
if( iCmd == 1 )
|
||||
{
|
||||
HMODULE hMod;
|
||||
ReadFile( hFromStdout, &hMod, sizeof(hMod), &iActual, NULL );
|
||||
char szName[MAX_PATH];
|
||||
if( !CrashGetModuleBaseName(hMod, szName) )
|
||||
strcpy( szName, "???" );
|
||||
iSize = strlen( szName );
|
||||
WriteToChild( hToStdin, &iSize, sizeof(iSize) );
|
||||
WriteToChild( hToStdin, szName, iSize );
|
||||
}
|
||||
HMODULE hMod;
|
||||
DWORD iActual;
|
||||
if( !ReadFile( hFromStdout, &hMod, sizeof(hMod), &iActual, NULL) )
|
||||
break;
|
||||
|
||||
char szName[MAX_PATH];
|
||||
if( !CrashGetModuleBaseName(hMod, szName) )
|
||||
strcpy( szName, "???" );
|
||||
iSize = strlen( szName );
|
||||
WriteToChild( hToStdin, &iSize, sizeof(iSize) );
|
||||
WriteToChild( hToStdin, szName, iSize );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -784,8 +784,7 @@ void ChildProcess()
|
||||
DoSave( sCrashReport );
|
||||
|
||||
/* Tell the crashing process that it can exit. Be sure to write crashinfo.txt first. */
|
||||
int iCmd = 0;
|
||||
write( _fileno(stdout), &iCmd, sizeof(iCmd) );
|
||||
fclose( stdout );
|
||||
|
||||
/* Now that we've done that, the process is gone. Don't use g_hParent. */
|
||||
CloseHandle( SymbolLookup::g_hParent );
|
||||
|
||||
Reference in New Issue
Block a user