From f9286f1e213978506b23d370fcef58b39bb4b3529ed9e209c657fdeac2698021 Mon Sep 17 00:00:00 2001 From: Michal Srb Date: Mon, 20 Feb 2017 17:45:48 +0000 Subject: [PATCH 1/2] - U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch * Fixes inetd mode with x server 1.19 (bnc#1025759) OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/tigervnc?expand=0&rev=103 --- ...-inetd-not-working-with-xserver-1-19.patch | 42 +++++++++++++++++++ tigervnc.changes | 6 +++ tigervnc.spec | 2 + 3 files changed, 50 insertions(+) create mode 100644 U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch diff --git a/U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch b/U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch new file mode 100644 index 0000000..68f1a3a --- /dev/null +++ b/U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch @@ -0,0 +1,42 @@ +From 712cf8673d6e57442f41636e44020f5e1839c7f8 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +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. + +Alan Coopersmith: Change to use dup2() for atomic switch of fd + +Signed-off-by: Hans de Goede + +diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c +index c5b684d..ef30d69 100644 +--- a/unix/xserver/hw/vnc/xvnc.c ++++ b/unix/xserver/hw/vnc/xvnc.c +@@ -572,9 +572,17 @@ ddxProcessArgument(int argc, char *argv[], int i) + + if (strcmp(argv[i], "-inetd") == 0) + { ++ int nullfd; ++ + 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(). */ ++ nullfd = open("/dev/null", O_WRONLY); ++ dup2(nullfd, 2); ++ close(nullfd); + + if (!displaySpecified) { + int port = vncGetSocketPort(vncInetdSock); diff --git a/tigervnc.changes b/tigervnc.changes index a8310fc..e653eba 100644 --- a/tigervnc.changes +++ b/tigervnc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Feb 20 17:43:56 UTC 2017 - msrb@suse.com + +- U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch + * Fixes inetd mode with x server 1.19 (bnc#1025759) + ------------------------------------------------------------------- Wed Jan 25 14:52:21 UTC 2017 - msrb@suse.com diff --git a/tigervnc.spec b/tigervnc.spec index 91abfaa..d6eb433 100644 --- a/tigervnc.spec +++ b/tigervnc.spec @@ -120,6 +120,7 @@ Patch7: u_tigervnc_update_default_vncxstartup.patch Patch8: u_build_libXvnc_as_separate_library.patch Patch9: u_tigervnc-show-unencrypted-warning.patch Patch10: U_Add-xorg-xserver-1.19-support.patch +Patch11: U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch %description TigerVNC is a high-performance, platform-neutral implementation of VNC (Virtual Network Computing), @@ -179,6 +180,7 @@ cp -r /usr/src/xserver/* unix/xserver/ %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 pushd unix/xserver patch -p1 < ../xserver119.patch From cce14268b6eddbef15de7fb1dab712fb7519b8d0855c762fdaf0a3ac3f2ecf15 Mon Sep 17 00:00:00 2001 From: Michal Srb Date: Mon, 20 Feb 2017 17:47:55 +0000 Subject: [PATCH 2/2] Update patch headers. OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/tigervnc?expand=0&rev=104 --- U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch b/U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch index 68f1a3a..469fa9c 100644 --- a/U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch +++ b/U_tigervnc-fix-inetd-not-working-with-xserver-1-19.patch @@ -1,7 +1,8 @@ -From 712cf8673d6e57442f41636e44020f5e1839c7f8 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Mon, 9 Jan 2017 16:03:30 +0100 -Subject: [PATCH] Fix -inetd not working with xserver >= 1.19 +Git-commit: 712cf8673d6e57442f41636e44020f5e1839c7f8 +Patch-Mainline: Upstream +Author: Hans de Goede +Subject: Fix -inetd not working with xserver >= 1.19 +Signed-off-by: Michal Srb 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.