mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-03-23 08:23:26 +08:00
Fix mosquitto_loop_start() leaving the mosq stuct in an invalid state
This occurs if thread creation fails. Closes #3496. Thanks to ehoffman2.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
2.0.23 - 2026-01-14
|
||||
2.0.23 - 2026-xx-xx
|
||||
===================
|
||||
|
||||
Broker:
|
||||
@@ -14,6 +14,10 @@ Broker:
|
||||
mosquitto 1.5 or earlier is loaded. Closes #3439.
|
||||
- Limit auto_id_prefix to 50 characters. Closes #3440.
|
||||
|
||||
Library:
|
||||
- Fix mosquitto_loop_start() leaving the mosq stuct in an invalid state if
|
||||
thread creation fails. Closes #3496.
|
||||
|
||||
Windows:
|
||||
- Installer will not overwrite an existing mosquitto.conf
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ int mosquitto_loop_start(struct mosquitto *mosq)
|
||||
#if defined(WITH_THREADING)
|
||||
if(!mosq || mosq->threaded != mosq_ts_none) return MOSQ_ERR_INVAL;
|
||||
|
||||
mosq->threaded = mosq_ts_self;
|
||||
if(!COMPAT_pthread_create(&mosq->thread_id, NULL, mosquitto__thread_main, mosq)){
|
||||
#if defined(__linux__)
|
||||
pthread_setname_np(mosq->thread_id, "mosquitto loop");
|
||||
@@ -50,6 +49,7 @@ int mosquitto_loop_start(struct mosquitto *mosq)
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
pthread_set_name_np(mosq->thread_id, "mosquitto loop");
|
||||
#endif
|
||||
mosq->threaded = mosq_ts_self;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}else{
|
||||
return MOSQ_ERR_ERRNO;
|
||||
|
||||
Reference in New Issue
Block a user