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,12 +401,18 @@ static void child_process()
/* keep going */ /* keep going */
} }
FILE *CrashDump = fopen("/tmp/crashinfo.txt", "w+"); const char *home = getenv( "HOME" );
if(CrashDump == NULL) CString sCrashInfoPath = "/tmp";
{ if( home )
fprintf(stderr, "Couldn't open /tmp/crashinfo.txt: %s\n", strerror(errno)); sCrashInfoPath = home;
exit(1); sCrashInfoPath += "/crashinfo.txt";
}
FILE *CrashDump = fopen( sCrashInfoPath, "w+" );
if(CrashDump == NULL)
{
fprintf( stderr, "Couldn't open " + sCrashInfoPath + ": %s\n", strerror(errno) );
exit(1);
}
fprintf(CrashDump, "%s crash report", PRODUCT_NAME_VER ); fprintf(CrashDump, "%s crash report", PRODUCT_NAME_VER );
#if defined(HAVE_VERSION_INFO) #if defined(HAVE_VERSION_INFO)
@@ -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"