Fix -inetd no longer working (rhbz#1408724)

This commit is contained in:
Hans de Goede 2017-01-09 16:57:03 +01:00
parent a374ec2445
commit 24bb17f891
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 372ff9d6754cd1b375836e5d4559061fb7be3496 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 9 Jan 2017 16:03:30 +0100
Subject: [PATCH] Fix -inetd not working with xserver >= 1.19
xserver 1.19's OsInit will create a pollfd, followed by checking if fd 2 /
stderr is writable and if it is not, replacing fd 2 with /dev/null.
Since we close stderr in inetd mode to avoid xserver messages being send
to the client as vnc data, the pollfd becomes fd 2, only to be replaced
by /dev/null since a pollfd is not writable.
This commit fixes this by opening /dev/null directly after the close(2),
avoiding that the pollfd becomes fd 2.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
unix/xserver/hw/vnc/xvnc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c
index 2f3cd4a..a747654 100644
--- a/unix/xserver/hw/vnc/xvnc.c
+++ b/unix/xserver/hw/vnc/xvnc.c
@@ -575,6 +575,10 @@ ddxProcessArgument(int argc, char *argv[], int i)
dup2(0,3);
vncInetdSock = 3;
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);
if (!displaySpecified) {
int port = vncGetSocketPort(vncInetdSock);
--
2.9.3

View File

@ -1,6 +1,6 @@
Name: tigervnc
Version: 1.7.0
Release: 5%{?dist}
Release: 6%{?dist}
Summary: A TigerVNC remote display system
%global _hardened_build 1
@ -49,6 +49,7 @@ Provides: tightvnc = 1.5.0-0.15.20090204svn3586
Obsoletes: tightvnc < 1.5.0-0.15.20090204svn3586
Patch1: tigervnc-1.7.0-xserver119-support.patch
Patch2: 0001-Fix-inetd-not-working-with-xserver-1.19.patch
Patch3: tigervnc-libvnc-os.patch
Patch7: tigervnc-manpages.patch
Patch8: tigervnc-getmaster.patch
@ -146,6 +147,7 @@ This package contains icons for TigerVNC viewer
%prep
%setup -q
%patch1 -p1 -b .xserver119
%patch2 -p1 -b .inetd
%patch3 -p1 -b .libvnc-os
cp -r /usr/share/xorg-x11-server-source/* unix/xserver
@ -325,6 +327,9 @@ fi
%{_datadir}/icons/hicolor/*/apps/*
%changelog
* Mon Jan 9 2017 Hans de Goede <hdegoede@redhat.com> - 1.7.0-6
- Fix -inetd no longer working (rhbz#1408724)
* Wed Nov 30 2016 Jan Grulich <jgrulich@redhat.com> - 1.7.0-5
- Fix broken vncserver.service file