Fix stdin being closed by mistake

This was closing the sockpair* sockets before they were initialised to INVALID_SOCKET.

Close #1823. Thanks to ostkamp.
This commit is contained in:
Roger A. Light 2020-09-14 19:35:22 +01:00
parent a53712a14d
commit acf4ff3738

View File

@ -113,6 +113,8 @@ struct mosquitto *mosquitto_new(const char *id, bool clean_start, void *userdata
#ifdef WITH_THREADING #ifdef WITH_THREADING
mosq->thread_id = pthread_self(); mosq->thread_id = pthread_self();
#endif #endif
mosq->sockpairR = INVALID_SOCKET;
mosq->sockpairW = INVALID_SOCKET;
rc = mosquitto_reinitialise(mosq, id, clean_start, userdata); rc = mosquitto_reinitialise(mosq, id, clean_start, userdata);
if(rc){ if(rc){
mosquitto_destroy(mosq); mosquitto_destroy(mosq);
@ -123,10 +125,6 @@ struct mosquitto *mosquitto_new(const char *id, bool clean_start, void *userdata
} }
return NULL; return NULL;
} }
if(net__socketpair(&mosq->sockpairR, &mosq->sockpairW)){
log__printf(mosq, MOSQ_LOG_WARNING,
"Warning: Unable to open socket pair, outgoing publish commands may be delayed.");
}
}else{ }else{
errno = ENOMEM; errno = ENOMEM;
} }