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 */
}
FILE *CrashDump = fopen("/tmp/crashinfo.txt", "w+");
if(CrashDump == NULL)
{
fprintf(stderr, "Couldn't open /tmp/crashinfo.txt: %s\n", strerror(errno));
exit(1);
}
const char *home = getenv( "HOME" );
CString sCrashInfoPath = "/tmp";
if( home )
sCrashInfoPath = home;
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 );
#if defined(HAVE_VERSION_INFO)
@@ -481,13 +487,13 @@ static void child_process()
fclose(CrashDump);
#if defined(DARWIN)
InformUserOfCrash();
InformUserOfCrash( sCrashInfoPath );
#else
fprintf(stderr,
"\n"
PRODUCT_NAME " has crashed. Debug information has been output to\n"
"\n"
" /tmp/crashinfo.txt\n"
" " + sCrashInfoPath + "\n"
"\n"
"Please report a bug at:\n"
"\n"