Skip to content

Commit

Permalink
- Fix -o not working in mosquitto_ctrl, and typo in related docum…
Browse files Browse the repository at this point in the history
…entation.

Closes #2471. Thanks to Vitaljok and rillbert
  • Loading branch information
ralight committed Aug 10, 2022
1 parent 6468bb4 commit f9fa19c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.txt
Expand Up @@ -33,6 +33,11 @@ Clients:
- Fix mosquitto_pub incorrectly reusing topic aliases when reconnecting.
Closes #2494.

Apps:
- Fix `-o` not working in `mosquitto_ctrl`, and typo in related documentation.
Closes #2471.


2.0.14 - 2021-11-17
===================

Expand Down
9 changes: 5 additions & 4 deletions apps/mosquitto_ctrl/options.c
Expand Up @@ -89,13 +89,14 @@ int ctrl_config_parse(struct mosq_config *cfg, int *argc, char **argv[])

init_config(cfg);

rc = client_config_load(cfg);
if(rc) return rc;

/* Deal with real argc/argv */
rc = client_config_line_proc(cfg, argc, argv);
if(rc) return rc;

/* Load options from config file - this must be after `-o` has been processed */
rc = client_config_load(cfg);
if(rc) return rc;

#ifdef WITH_TLS
if((cfg->certfile && !cfg->keyfile) || (cfg->keyfile && !cfg->certfile)){
fprintf(stderr, "Error: Both certfile and keyfile must be provided if one of them is set.\n");
Expand Down Expand Up @@ -531,7 +532,7 @@ int client_config_load(struct mosq_config *cfg)
fclose(fptr);
return 1;
}
while(fgets(line, 1024, fptr)){
while(fgets(line, sizeof(line), fptr)){
if(line[0] == '#') continue; /* Comments */

while(line[strlen(line)-1] == 10 || line[strlen(line)-1] == 13){
Expand Down
6 changes: 3 additions & 3 deletions www/pages/documentation/dynamic-security.md
Expand Up @@ -389,9 +389,9 @@ admin username and any other options once and not have to add them to the
command line every time.

mosquitto_ctrl will try to load a configuration file from a default location.
For Windows this is at `%USER_PROFILE%\mosquitto_ctrl.conf`. For other systems,
it will try `$XDG_CONFIG_HOME/mosquitto_ctrl.conf` or
`$HOME/.config/mosquitto_ctrl.conf`.
For Windows this is at `%USER_PROFILE%\mosquitto_ctrl`. For other systems,
it will try `$XDG_CONFIG_HOME/mosquitto_ctrl` or
`$HOME/.config/mosquitto_ctrl`.

You may override this behaviour by manually specifying an options file with
`-o <path to options file>`.
Expand Down

0 comments on commit f9fa19c

Please sign in to comment.