From: Fabian Keil <fk@fabiankeil.de>
Date: Thu, 27 Aug 2020 22:32:40 +0000 (+0200)
Subject: listen_loop(): Use a dedicated variable for the pthread_create() return code
X-Git-Tag: v_3_0_29~175
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/faq/@default-cgi@/static/@proxy-info-url@?a=commitdiff_plain;h=9969b0d688c6730348572c9aff2254bd55ec94e0;p=privoxy.git

listen_loop(): Use a dedicated variable for the pthread_create() return code

... instead of clobbering errno.

Sponsored by: Robert Klemme
---

diff --git a/jcc.c b/jcc.c
index fab23781..8d92f65c 100644
--- a/jcc.c
+++ b/jcc.c
@@ -5604,10 +5604,11 @@ static void listen_loop(void)
 #define SELECTED_ONE_OPTION
          {
             pthread_t the_thread;
+            int ret;
 
-            errno = pthread_create(&the_thread, &attrs,
+            ret = pthread_create(&the_thread, &attrs,
                (void * (*)(void *))serve, csp);
-            child_id = errno ? -1 : 0;
+            child_id = ret ? -1 : 0;
          }
 #endif