[PATCH libX11 v2 1/4] Add _XGetRequest as substitute for GetReq/GetReqExtra

Jamey Sharp jamey at minilop.net
Thu Oct 27 00:55:53 PDT 2011


On Thu, Oct 27, 2011 at 09:15:54AM +0200, walter harms wrote:
> Am 27.10.2011 06:21, schrieb Peter Hutterer:
> > +void *_XGetRequest(Display *dpy, CARD8 type, size_t len)
> > +{
> > +    xReq *req;
> > +
> > +    WORD64ALIGN
> > +
> > +    if (dpy->bufptr + len > dpy->bufmax)
> > +	_XFlush(dpy);
> > +
> > +    if (len % 4)
> > +	fprintf(stderr,
> > +		"Xlib: request %d length %zd not a multiple of 4.\n",
> > +		type, len);
> 
> Does it make sense to continue here ?
> perhaps you want a add a return NULL ?

It doesn't make sense to continue, but there's no way to report the
error that any caller can handle. If you return NULL here, the caller is
guaranteed to segfault.

Since these errors are already possible today, but aren't being even
noticed, I think Peter's choice of a printf is the best we can do. At
least it allows the possibility of somebody noticing the bug.

It'd be nice if we could get more information than the minor opcode for
extension requests, but nothing else is immediately obvious to me here.

Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111027/9d89e53b/attachment.pgp>


More information about the xorg-devel mailing list