summaryrefslogtreecommitdiffstats
path: root/source/l/libvncserver/libvncserver.d0a76539835d11c0f4723499f8be4bc9c7724eb9.patch
blob: 7ef6ec2213f61ad3c9b94ee6991225a744ce1ff5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 d3cd9b1e..772fb18f 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