diff options
author | Alexander Tsoy <alexander@tsoy.me> | 2020-01-14 20:04:01 +0300 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2020-01-15 20:32:45 +0100 |
commit | 578ad0d4d400d6ab947a44aa56dde4186a0d256e (patch) | |
tree | 44b65149b422b3849c85881c56c722e090452c14 /net-libs/libvncserver/files/libvncserver-0.9.12-fix-shutdown-crash.patch | |
parent | net-libs/aqbanking: 5.99.45 version bump (diff) | |
download | gentoo-578ad0d4d400d6ab947a44aa56dde4186a0d256e.tar.gz gentoo-578ad0d4d400d6ab947a44aa56dde4186a0d256e.tar.bz2 gentoo-578ad0d4d400d6ab947a44aa56dde4186a0d256e.zip |
net-libs/libvncserver: fix crash on exit
Closes: https://bugs.gentoo.org/705124
Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Closes: https://github.com/gentoo/gentoo/pull/14337
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'net-libs/libvncserver/files/libvncserver-0.9.12-fix-shutdown-crash.patch')
-rw-r--r-- | net-libs/libvncserver/files/libvncserver-0.9.12-fix-shutdown-crash.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/net-libs/libvncserver/files/libvncserver-0.9.12-fix-shutdown-crash.patch b/net-libs/libvncserver/files/libvncserver-0.9.12-fix-shutdown-crash.patch new file mode 100644 index 000000000000..0ae8d38c6f89 --- /dev/null +++ b/net-libs/libvncserver/files/libvncserver-0.9.12-fix-shutdown-crash.patch @@ -0,0 +1,63 @@ +From d0a76539835d11c0f4723499f8be4bc9c7724eb9 Mon Sep 17 00:00:00 2001 +From: Rajesh Sahoo <rajesh.sahoo@lge.com> +Date: Tue, 11 Jun 2019 15:13:04 +0530 +Subject: [PATCH] avoid pthread_join if backgroundLoop is FALSE + +client_thread is created depending upon backgroundLoop, but joining +without checking for same condition. so we are trying to join a garbage +thread_id. +--- + libvncserver/main.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libvncserver/main.c b/libvncserver/main.c +index d3cd9b1..772fb18 100644 +--- a/libvncserver/main.c ++++ b/libvncserver/main.c +@@ -1112,6 +1112,7 @@ void rfbShutdownServer(rfbScreenInfoPtr screen,rfbBool disconnectClients) { + } + + #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD ++ if(currentCl->screen->backgroundLoop) { + /* + Notify the thread. This simply writes a NULL byte to the notify pipe in order to get past the select() + in clientInput(), the loop in there will then break because the rfbCloseClient() above has set +@@ -1120,6 +1121,7 @@ void rfbShutdownServer(rfbScreenInfoPtr screen,rfbBool disconnectClients) { + write(currentCl->pipe_notify_client_thread[1], "\x00", 1); + /* And wait for it to finish. */ + pthread_join(currentCl->client_thread, NULL); ++ } + #else + rfbClientConnectionGone(currentCl); + #endif +-- +2.24.1 + +From 15c4f144a3783d9f1f2c976acf9f4d85988fd466 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid <aacid@kde.org> +Date: Sun, 5 Jan 2020 19:56:57 +0100 +Subject: [PATCH] rfbShutdownServer: Call rfbClientConnectionGone if no + backgroundLoop + +Otherwise the servers that don't use rfbRunEventLoop don't get +notified of client disconnections +--- + libvncserver/main.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libvncserver/main.c b/libvncserver/main.c +index b51f0ab..738a501 100644 +--- a/libvncserver/main.c ++++ b/libvncserver/main.c +@@ -1152,6 +1152,8 @@ void rfbShutdownServer(rfbScreenInfoPtr screen,rfbBool disconnectClients) { + write(currentCl->pipe_notify_client_thread[1], "\x00", 1); + /* And wait for it to finish. */ + pthread_join(currentCl->client_thread, NULL); ++ } else { ++ rfbClientConnectionGone(currentCl); + } + #else + rfbClientConnectionGone(currentCl); +-- +2.24.1 + |