Report an error if the config file is set to a directory.

Closes #1814. Thanks to Odysseus1710.
pull/1920/head
Roger A. Light 5 years ago
parent 29c771cdd4
commit c39a42adcc

@ -92,6 +92,7 @@ Broker:
- Default for max_queued_messages has been changed to 1000.
- Add `ciphers_tls1.3` option, to allow setting TLS v1.3 ciphersuites.
Closes #1825.
- Report an error if the config file is set to a directory. Closes #1814.
Client library:
- Client no longer generates random client ids for v3.1.1 clients, these are

@ -2174,6 +2174,18 @@ int config__read_file(struct mosquitto__config *config, bool reload, const char
FILE *fptr = NULL;
char *buf;
int buflen;
#ifndef WIN32
DIR *dir;
#endif
#ifndef WIN32
dir = opendir(file);
if(dir){
closedir(dir);
log__printf(NULL, MOSQ_LOG_ERR, "Error: Config file %s is a directory.", file);
return 1;
}
#endif
fptr = mosquitto__fopen(file, "rt", false);
if(!fptr){

Loading…
Cancel
Save