[PATCH xclock] Fix a crash on sparc64

Michael macallan at netbsd.org
Thu Jul 29 13:08:17 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Jul 29, 2010, at 3:54 PM, Alan Coopersmith wrote:

> Matthieu Herrb wrote:
>> From 017b77fa3323f34f7cf09efbe0e3358a3ea733f8 Mon Sep 17 00:00:00  
>> 2001
>> From: David Coppa <dcoppa at gmail.com>
>> Date: Thu, 29 Jul 2010 21:46:11 +0200
>> Subject: [PATCH xclock] Fix a crash on sparc64.
>>
>> The pid variable that is passed to XChangeProperty() is not a long.
>> The libX11 code deferences the variable as a long and on a 64-bit  
>> sparc
>> this must be aligned on a 8-byte boundary.
>>
>> Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
>> ---
>> xclock.c |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/xclock.c b/xclock.c
>> index 6b80ad0..5965a83 100644
>> --- a/xclock.c
>> +++ b/xclock.c
>> @@ -215,7 +215,7 @@ main(int argc, char *argv[])
>>
>> #ifdef HAVE_GETPID
>>     {
>> -	pid_t pid = getpid();
>> +	unsigned long pid = (unsigned long)getpid();
>> 	XChangeProperty(XtDisplay(toplevel), XtWindow(toplevel),
>> 			XInternAtom(XtDisplay(toplevel), "_NET_WM_PID", False),
>> 			XA_CARDINAL, 32, PropModeReplace,
>
> Oops.  Oh how I wish we could undo xlib's "CARD32 is always long"  
> confusion...

Yeah, that's the single most counter-intuitive 'feature' in libX11.  
You don't want to know how many times I had for fix bugs like that.

have fun
Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQEVAwUBTFHfscpnzkX8Yg2nAQJUVQf/Vw7psK+XQMrRDigoFDO9R30NYix/eMib
7pB+n80vHFBZ9BdLFhuxm2KgBGGfzOi31cZ/JNUQYgUM8UIBU0hkQmZm2daJ3HME
VUnanqS9p36CB+nV4GVlBH3l1miQpF7cNgDWkE6prkXdQZi/l3aGGpjTPfZRUIfK
CzIYDqAF0biBWXfFHunxDXJYM1ibcs9ooaHlHBPNgNs3tCDDdf20J3cJmL9gv96q
7FZ3r0cmhN2KFk21cURky+lnXUkIsu66pTKtiZVYYYT7ZpIXwIpb7nH0FtM9Bfpx
mgAEzirESlwsMjdDja/UWdTnMhsPr7wsn00v8ASTEBRwz3s+tdvsng==
=rvk7
-----END PGP SIGNATURE-----


More information about the xorg-devel mailing list