dbus/test test-segfault.c,1.4,1.5

Havoc Pennington hp at redhat.com
Wed Mar 7 11:09:15 PST 2007


Hi,

Please, send changes to cross-platform files to the list or bugzilla... 
comments below

Ralf Habacker wrote:
> --- test-segfault.c	30 Nov 2005 19:32:26 -0000	1.4
> +++ test-segfault.c	7 Mar 2007 18:34:01 -0000	1.5
> @@ -1,15 +1,14 @@
>  /* This is simply a process that segfaults */
> +#include <config.h>

Good

>  #include <stdlib.h>
>  #include <signal.h>
>  
> -#include <sys/time.h>
> -#include <sys/resource.h>
> -

These are required on Linux according to "man setrlimit" so they can't 
be unconditionally removed. Should probably be inside HAVE_SETRLIMIT or 
something.

> +#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)

I don't think we want to check both WIN and WINCE all over the code, I 
would think DBUS_WIN means "either windows or wince" and perhaps 
DBUS_WINCE and DBUS_WIN32/DBUS_WINDESKTOP/something are used in the few 
places that are different between Windows flavors.

In this particular case, #ifdef HAVE_SETRLIMIT would be even better, though.

>    struct rlimit r = { 0, };
>    
>    getrlimit (RLIMIT_CORE, &r);
> @@ -17,7 +16,7 @@
>    setrlimit (RLIMIT_CORE, &r);
>    
>    raise (SIGSEGV);
> -
> +#endif
>    p = NULL;
>    *p = 'a';

By default, I'm not sure dereferencing null crashes a Windows app ... in 
fact this whole test is probably nonsense on Windows, since the point of 
this test is to be sure the activation code properly handles a 
segfaulting service. So it may be more appropriate to simply remove 
test-segfault from the Windows build, and put "#ifndef DBUS_WIN" around 
the test code that tries to activate the segfault service. I believe 
that's in dispatch.c

Havoc



More information about the dbus mailing list