ditch explicit close command; just close the handle

This commit is contained in:
Glenn Maynard
2006-02-13 23:02:06 +00:00
parent 9eddbde5ac
commit 4b7f50f673
2 changed files with 13 additions and 19 deletions
+12 -17
View File
@@ -247,27 +247,22 @@ void RunChild()
WriteToChild( hToStdin, p, iSize ); WriteToChild( hToStdin, p, iSize );
/* The parent process needs to access this process briefly. When it's done, it'll /* 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) 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, /* Ugly: the new process can't execute GetModuleFileName on this process,
* since GetModuleFileNameEx might not be available. Run the requests here. */ * since GetModuleFileNameEx might not be available. Run the requests here. */
if( iCmd == 1 ) HMODULE hMod;
{ DWORD iActual;
HMODULE hMod; if( !ReadFile( hFromStdout, &hMod, sizeof(hMod), &iActual, NULL) )
ReadFile( hFromStdout, &hMod, sizeof(hMod), &iActual, NULL ); break;
char szName[MAX_PATH];
if( !CrashGetModuleBaseName(hMod, szName) ) char szName[MAX_PATH];
strcpy( szName, "???" ); if( !CrashGetModuleBaseName(hMod, szName) )
iSize = strlen( szName ); strcpy( szName, "???" );
WriteToChild( hToStdin, &iSize, sizeof(iSize) ); iSize = strlen( szName );
WriteToChild( hToStdin, szName, iSize ); WriteToChild( hToStdin, &iSize, sizeof(iSize) );
} WriteToChild( hToStdin, szName, iSize );
} }
} }
@@ -784,8 +784,7 @@ void ChildProcess()
DoSave( sCrashReport ); DoSave( sCrashReport );
/* Tell the crashing process that it can exit. Be sure to write crashinfo.txt first. */ /* Tell the crashing process that it can exit. Be sure to write crashinfo.txt first. */
int iCmd = 0; fclose( stdout );
write( _fileno(stdout), &iCmd, sizeof(iCmd) );
/* Now that we've done that, the process is gone. Don't use g_hParent. */ /* Now that we've done that, the process is gone. Don't use g_hParent. */
CloseHandle( SymbolLookup::g_hParent ); CloseHandle( SymbolLookup::g_hParent );