write crashinfo to ~; in /tmp, it won't be written if some other user already has a crashinfo.txt there

This commit is contained in:
Glenn Maynard
2004-03-06 01:19:05 +00:00
parent 436d3bc65e
commit ad6a7d8ff2
@@ -401,10 +401,16 @@ static void child_process()
/* keep going */ /* keep going */
} }
FILE *CrashDump = fopen("/tmp/crashinfo.txt", "w+"); const char *home = getenv( "HOME" );
CString sCrashInfoPath = "/tmp";
if( home )
sCrashInfoPath = home;
sCrashInfoPath += "/crashinfo.txt";
FILE *CrashDump = fopen( sCrashInfoPath, "w+" );
if(CrashDump == NULL) if(CrashDump == NULL)
{ {
fprintf(stderr, "Couldn't open /tmp/crashinfo.txt: %s\n", strerror(errno)); fprintf( stderr, "Couldn't open " + sCrashInfoPath + ": %s\n", strerror(errno) );
exit(1); exit(1);
} }
@@ -481,13 +487,13 @@ static void child_process()
fclose(CrashDump); fclose(CrashDump);
#if defined(DARWIN) #if defined(DARWIN)
InformUserOfCrash(); InformUserOfCrash( sCrashInfoPath );
#else #else
fprintf(stderr, fprintf(stderr,
"\n" "\n"
PRODUCT_NAME " has crashed. Debug information has been output to\n" PRODUCT_NAME " has crashed. Debug information has been output to\n"
"\n" "\n"
" /tmp/crashinfo.txt\n" " " + sCrashInfoPath + "\n"
"\n" "\n"
"Please report a bug at:\n" "Please report a bug at:\n"
"\n" "\n"