[PATCH] xf86-input-synaptics: fix creation of repeater fifo

Magnus Kessler Magnus.Kessler at gmx.net
Sun Sep 28 07:11:46 PDT 2008


On Sunday 28 September 2008, Peter Hutterer wrote:
> On Sun, Sep 28, 2008 at 10:09:01AM +0100, Magnus Kessler wrote:
> > The creation of the repeater fifo in the synaptics driver looks
> > dubious. The file mode should be ORed with the S_IFIFO flag and the dev
> > parameter should be null. The mknod(3p) man page suggests using mkfifo
> > instead.
>
> Agreed.
>
> >[...]
> >     repeater = xf86SetStrOption(local->options, "Repeater", NULL);
> >     if (repeater) {
> > 	/* create repeater fifo */
> >-	status = mknod(repeater, 666, S_IFIFO);
> >-	if ((status != 0) && (status != EEXIST)) {
> >+	if (mkfifo(repeater, S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IWOTH|S_IROTH))
> > { xf86Msg(X_ERROR, "%s can't create repeater fifo\n", local->name); }
> > else {
> > 	    /* open the repeater fifo */
>
> Any special reason for dropping the EEXIST case?
>
> Cheers,
>   Peter

From mkfifo(3p):

Upon successful completion, 0 shall be returned. Otherwise, -1 shall be 
returned, no FIFO shall be created, and errno shall be set to indicate the 
error.

Testing status against EEXIST is wrong and we should check errno instead if 
we want to allow the use of an existing file. However, since we pass a file 
name that in principle could be any existing file (not just fifos) is there 
any guarantee that we can later actually use the fifo?

New patch attached.

Cheers,

Magnus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: synaptics-fix-repeater-fifo-v2.diff
Type: text/x-diff
Size: 939 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20080928/b1e3f924/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.x.org/archives/xorg/attachments/20080928/b1e3f924/attachment.pgp>


More information about the xorg mailing list