Home | History | Annotate | Download | only in patches
      1 --- bug-buddy-2.20.1.old/gnome-breakpad/gnome-breakpad.cc	2007-10-08 13:08:48.629741000 +0100
      2 +++ bug-buddy-2.20.1/gnome-breakpad/gnome-breakpad.cc	2007-10-08 13:14:19.366685000 +0100
      3 @@ -13,6 +13,7 @@
      4  #include <sys/stat.h>
      5  #include <fcntl.h>
      6  #include <signal.h>
      7 +#include <dlfcn.h>
      8  #include <sys/wait.h>
      9  
     10  #include <glib.h>
     11 @@ -339,34 +340,39 @@
     12  int
     13  gtk_module_init (int *argc, char** argv[])
     14  {
     15 +	void *handle;
     16  	bugbuddy = g_find_program_in_path ("bug-buddy");
     17  	
     18  	if (bugbuddy && !g_getenv ("GNOME_DISABLE_CRASH_DIALOG")) {
     19  #ifdef ENABLE_GOOGLE_BREAKPAD
     20 -        	static struct sigaction old_action;
     21 +       	static struct sigaction old_action;
     22  
     23 -		sigaction(SIGSEGV, NULL, &old_action);
     24 -		if (old_action.sa_handler != SIG_DFL)
     25 -			return 0;
     26 -
     27 -                sigaction(SIGABRT, NULL, &old_action);
     28 -		if (old_action.sa_handler != SIG_DFL)
     29 -			return 0;
     30 -
     31 -                sigaction(SIGTRAP, NULL, &old_action);
     32 -		if (old_action.sa_handler != SIG_DFL)
     33 -			return 0;
     34 -
     35 -                sigaction(SIGFPE, NULL, &old_action);
     36 -		if (old_action.sa_handler != SIG_DFL)
     37 -			return 0;
     38 -
     39 -                sigaction(SIGBUS, NULL, &old_action);
     40 -		if (old_action.sa_handler != SIG_DFL)
     41 -			return 0;
     42 +		if ((handle = dlopen ("libjsig.so", RTLD_LAZY)) == NULL) {
     43 +			sigaction(SIGSEGV, NULL, &old_action);
     44 +			if (old_action.sa_handler != SIG_DFL)
     45 +				return 0;
     46 +
     47 +			sigaction(SIGABRT, NULL, &old_action);
     48 +			if (old_action.sa_handler != SIG_DFL)
     49 +				return 0;
     50 +
     51 +            sigaction(SIGTRAP, NULL, &old_action);
     52 +			if (old_action.sa_handler != SIG_DFL)
     53 +				return 0;
     54 +
     55 +            sigaction(SIGFPE, NULL, &old_action);
     56 +			if (old_action.sa_handler != SIG_DFL)
     57 +				return 0;
     58 +
     59 +            sigaction(SIGBUS, NULL, &old_action);
     60 +			if (old_action.sa_handler != SIG_DFL)
     61 +						return 0;
     62  
     63 -  		static ExceptionHandler handler("/tmp", check_if_gdb,
     64 +  			static ExceptionHandler handler("/tmp", check_if_gdb,
     65  						MinidumpCallback, NULL, true);
     66 +		} else {
     67 +			dlclose (handle);
     68 +		}
     69  #else
     70          	static struct sigaction *setptr;
     71          	static struct sigaction old_action;
     72 @@ -376,25 +382,30 @@
     73  
     74                  sa.sa_handler = bugbuddy_segv_handle;
     75  
     76 -                sigaction(SIGSEGV, NULL, &old_action);
     77 -		if (old_action.sa_handler == SIG_DFL)
     78 -                	sigaction(SIGSEGV, setptr, NULL);
     79 -
     80 -                sigaction(SIGABRT, NULL, &old_action);
     81 -		if (old_action.sa_handler == SIG_DFL)
     82 -                	sigaction(SIGABRT, setptr, NULL);
     83 -
     84 -                sigaction(SIGTRAP, NULL, &old_action);
     85 -		if (old_action.sa_handler == SIG_DFL)
     86 -                	sigaction(SIGTRAP, setptr, NULL);
     87 -
     88 -                sigaction(SIGFPE, NULL, &old_action);
     89 -		if (old_action.sa_handler == SIG_DFL)
     90 -                	sigaction(SIGFPE, setptr, NULL);
     91 -
     92 -                sigaction(SIGBUS, NULL, &old_action);
     93 -		if (old_action.sa_handler == SIG_DFL)
     94 -                	sigaction(SIGBUS, setptr, NULL);
     95 +				if ((handle = dlopen ("libjsig.so", RTLD_LAZY)) == NULL) {
     96 +
     97 +                	sigaction(SIGSEGV, NULL, &old_action);
     98 +					if (old_action.sa_handler == SIG_DFL)
     99 +                		sigaction(SIGSEGV, setptr, NULL);
    100 +
    101 +                	sigaction(SIGABRT, NULL, &old_action);
    102 +					if (old_action.sa_handler == SIG_DFL)
    103 +                		sigaction(SIGABRT, setptr, NULL);
    104 +
    105 +                	sigaction(SIGTRAP, NULL, &old_action);
    106 +					if (old_action.sa_handler == SIG_DFL)
    107 +                		sigaction(SIGTRAP, setptr, NULL);
    108 +
    109 +                	sigaction(SIGFPE, NULL, &old_action);
    110 +					if (old_action.sa_handler == SIG_DFL)
    111 +                		sigaction(SIGFPE, setptr, NULL);
    112 +
    113 +                	sigaction(SIGBUS, NULL, &old_action);
    114 +					if (old_action.sa_handler == SIG_DFL)
    115 +                		sigaction(SIGBUS, setptr, NULL);
    116 +				} else {
    117 +					dlclose (handle);
    118 +				}
    119  #endif
    120  	}
    121  	return 0;
    122