listen_loop(): Use a dedicated variable for the pthread_create() return code
authorFabian Keil <fk@fabiankeil.de>
Thu, 27 Aug 2020 22:32:40 +0000 (00:32 +0200)
committerFabian Keil <fk@fabiankeil.de>
Tue, 1 Sep 2020 10:22:42 +0000 (12:22 +0200)
... instead of clobbering errno.

Sponsored by: Robert Klemme

jcc.c

diff --git a/jcc.c b/jcc.c
index fab2378..8d92f65 100644 (file)
--- 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