DS3100: buggy cc

Matt Thomas thomas at mipsbx.nac.dec.com
Wed Jun 7 01:12:41 AEST 1989


> I have not got any responses on my query yet and my problem remains. In the
> meantime I have been able to extract the essence of the bug and put it into a
> small example which is included below. What can possibly go wrong??? 

You have a bug in your program.

>[most of progam deleted]
>
> do_nextevent()
> {
> 	XAnyEvent e;
> 
> 	XNextEvent(display, &e);
> }

XNextEvent takes a pointer to a XEvent as the second parameter, not a 
pointer to XAnyEvent.  The structure XAnyEvent is smaller than XEvent
so when XNextEvent copies the event into *e, part fo the stack is over-
written causing the segmentation fault.

Changing XAnyEvent e to XEvent e will make the program work correctly.

-- 
Matt Thomas                     Internet:   thomas at decwrl.dec.com
DECnet-Ultrix Development       UUCP:       ...!decwrl!thomas
Digital Equipment Corporation   Disclaimer: This message reflects my own
Littleton, MA                               warped views, etc.



More information about the Comp.unix.ultrix mailing list