[tigervnc-devel] PATCH: Add xorg-xserver 1.19 support to tigervnc

Keith Packard keithp at keithp.com
Mon Jan 9 18:09:46 UTC 2017


Alan Coopersmith <alan.coopersmith at oracle.com> writes:

> On 01/ 9/17 07:57 AM, Hans de Goede wrote:
>>  	close(2);
>> +	/* Avoid xserver >= 1.19's epoll-fd becoming fd 2 / stderr only to be
>> +	   replaced by /dev/null by OsInit() because the pollfd is not
>> +	   writable, breaking ospoll_wait(). */
>> +	open("/dev/null", O_WRONLY);

I'd suggest stripping out the OsInit code which messes with FDs now that
we leave stdin/stdout/stderr alone in the normal case. We should have
done this when the code messing with those FDs was removed.

> Hopefully no other threads in the X server are opening files, but if any ever
> do, it would be more reliable to do:
>
> 	nullfd = open("/dev/null", O_WRONLY);
> 	dup2(nullfd, 2);
> 	close(nullfd);
>
> and let dup2 atomically close the old stderr and clone nullfd to it.

Yeah, this looks like a more reliable fix.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20170109/db415438/attachment.sig>


More information about the xorg-devel mailing list