Do not start threads in detached mode. Joining them may SEGFAULT with libmusl

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-07-09 18:58:55 +02:00
parent 5c97d29033
commit 00ff114cab
3 changed files with 1 additions and 7 deletions
+1 -3
View File
@@ -2912,12 +2912,10 @@ void FTL_fork_and_bind_sockets(struct passwd *ent_pw, bool dnsmasq_start)
// so they will not listen to real-time signals
handle_realtime_signals();
// We will use the attributes object later to start all threads in
// detached mode
pthread_attr_t attr;
// Initialize thread attributes object with default attribute values
// Do NOT detach threads as we want to join them during shutdown with a
// fixed timeout to give them time to clean up and finish their work
pthread_attr_t attr;
pthread_attr_init(&attr);
// Initialize NTP server
-2
View File
@@ -616,8 +616,6 @@ int run_arp_scan(const bool scan_all, const bool extreme_mode)
pthread_attr_t attr;
// Initialize thread attributes object with default attribute values
pthread_attr_init(&attr);
// Set thread attributes to detached mode
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
struct ifaddrs *addrs, *tmp;
getifaddrs(&addrs);
-2
View File
@@ -725,8 +725,6 @@ int run_dhcp_discover(void)
pthread_attr_t attr;
// Initialize thread attributes object with default attribute values
pthread_attr_init(&attr);
// Set thread attributes to detached mode
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
// Create processing/printfing lock
pthread_mutexattr_t lock_attr;