|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* This file is part of the KDE Libraries
|
|
|
|
|
* This file is part of the TDE Libraries
|
|
|
|
|
* Copyright (C) 2000 Timo Hummel <timo.hummel@sap.com>
|
|
|
|
|
* Tom Braun <braunt@fh-konstanz.de>
|
|
|
|
|
*
|
|
|
|
@ -33,7 +33,7 @@
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include "kcrash.h"
|
|
|
|
|
#include "tdecrash.h"
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
@ -148,10 +148,10 @@ TDECrash::defaultCrashHandler (int sig)
|
|
|
|
|
if (appName)
|
|
|
|
|
{
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
|
fprintf(stderr, "[kcrash] TDECrash: crashing... crashRecursionCounter = %d\n", crashRecursionCounter);
|
|
|
|
|
fprintf(stderr, "[kcrash] TDECrash: Application Name = %s path = %s pid = %d\n", appName ? appName : "<unknown>" , appPath ? appPath : "<unknown>", getpid());
|
|
|
|
|
fprintf(stderr, "[tdecrash] TDECrash: crashing... crashRecursionCounter = %d\n", crashRecursionCounter);
|
|
|
|
|
fprintf(stderr, "[tdecrash] TDECrash: Application Name = %s path = %s pid = %d\n", appName ? appName : "<unknown>" , appPath ? appPath : "<unknown>", getpid());
|
|
|
|
|
#else
|
|
|
|
|
fprintf(stderr, "[kcrash] TDECrash: Application '%s' crashing...\n", appName ? appName : "<unknown>");
|
|
|
|
|
fprintf(stderr, "[tdecrash] TDECrash: Application '%s' crashing...\n", appName ? appName : "<unknown>");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
const char * argv[24]; // don't forget to update this
|
|
|
|
@ -231,13 +231,13 @@ TDECrash::defaultCrashHandler (int sig)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
fprintf(stderr, "[kcrash] Unknown appname\n");
|
|
|
|
|
fprintf(stderr, "[tdecrash] Unknown appname\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (crashRecursionCounter < 4)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "[kcrash] Unable to start Dr. Konqi\n");
|
|
|
|
|
fprintf(stderr, "[tdecrash] Unable to start Dr. Konqi\n");
|
|
|
|
|
}
|
|
|
|
|
#endif //Q_OS_UNIX
|
|
|
|
|
|
|
|
|
@ -277,7 +277,7 @@ void TDECrash::startDrKonqi( const char* argv[], int argc )
|
|
|
|
|
int len = strlen( argv[ i ] ) + 1; // include terminating \0
|
|
|
|
|
if( pos + len > BUFSIZE )
|
|
|
|
|
{
|
|
|
|
|
fprintf( stderr, "[kcrash] BUFSIZE in TDECrash not big enough!\n" );
|
|
|
|
|
fprintf( stderr, "[tdecrash] BUFSIZE in TDECrash not big enough!\n" );
|
|
|
|
|
startDirectly( argv, argc );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -317,7 +317,7 @@ void TDECrash::startDrKonqi( const char* argv[], int argc )
|
|
|
|
|
// If we can't reach tdeinit we can still at least try to fork()
|
|
|
|
|
void TDECrash::startDirectly( const char* argv[], int )
|
|
|
|
|
{
|
|
|
|
|
fprintf( stderr, "[kcrash] TDECrash cannot reach tdeinit, launching directly.\n" );
|
|
|
|
|
fprintf( stderr, "[tdecrash] TDECrash cannot reach tdeinit, launching directly.\n" );
|
|
|
|
|
pid_t pid = fork();
|
|
|
|
|
if (pid <= 0)
|
|
|
|
|
{
|
|
|
|
@ -448,12 +448,12 @@ static int openSocket()
|
|
|
|
|
{
|
|
|
|
|
if (!home_dir || !home_dir[0])
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "[kcrash] Warning: $HOME not set!\n");
|
|
|
|
|
fprintf(stderr, "[tdecrash] Warning: $HOME not set!\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (strlen(home_dir) > (MAX_SOCK_FILE-100))
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "[kcrash] Warning: Home directory path too long!\n");
|
|
|
|
|
fprintf(stderr, "[tdecrash] Warning: Home directory path too long!\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
kde_home++;
|
|
|
|
@ -470,7 +470,7 @@ static int openSocket()
|
|
|
|
|
strncat(sock_file, getenv("XAUTHLOCALHOSTNAME"), MAX_SOCK_FILE - strlen(sock_file) - 1);
|
|
|
|
|
else if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
|
|
|
|
|
{
|
|
|
|
|
perror("[kcrash] Warning: Could not determine hostname: ");
|
|
|
|
|
perror("[tdecrash] Warning: Could not determine hostname: ");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
sock_file[sizeof(sock_file)-1] = '\0';
|
|
|
|
@ -479,13 +479,13 @@ static int openSocket()
|
|
|
|
|
display = getDisplay();
|
|
|
|
|
if (display == NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "[kcrash] Error: Could not determine display.\n");
|
|
|
|
|
fprintf(stderr, "[tdecrash] Error: Could not determine display.\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(sock_file)+strlen(display)+strlen("/tdeinit_")+2 > MAX_SOCK_FILE)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "[kcrash] Warning: Socket name will be too long.\n");
|
|
|
|
|
fprintf(stderr, "[tdecrash] Warning: Socket name will be too long.\n");
|
|
|
|
|
free(display);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
@ -495,7 +495,7 @@ static int openSocket()
|
|
|
|
|
|
|
|
|
|
if (strlen(sock_file) >= sizeof(server.sun_path))
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "[kcrash] Warning: Path of socketfile exceeds UNIX_PATH_MAX.\n");
|
|
|
|
|
fprintf(stderr, "[tdecrash] Warning: Path of socketfile exceeds UNIX_PATH_MAX.\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -505,7 +505,7 @@ static int openSocket()
|
|
|
|
|
s = socket(PF_UNIX, SOCK_STREAM, 0);
|
|
|
|
|
if (s < 0)
|
|
|
|
|
{
|
|
|
|
|
perror("[kcrash] Warning: socket creation failed: ");
|
|
|
|
|
perror("[tdecrash] Warning: socket creation failed: ");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -514,7 +514,7 @@ static int openSocket()
|
|
|
|
|
socklen = sizeof(server);
|
|
|
|
|
if(connect(s, (struct sockaddr *)&server, socklen) == -1)
|
|
|
|
|
{
|
|
|
|
|
perror("[kcrash] Warning: socket connection failed: ");
|
|
|
|
|
perror("[tdecrash] Warning: socket connection failed: ");
|
|
|
|
|
close(s);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|