aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV.Krishn <vkrishn4@gmail.com>2019-12-04 17:39:01 +0530
committerV.Krishn <vkrishn4@gmail.com>2019-12-04 17:39:01 +0530
commitda6bcb151f0465d060ac43c27a6cdcfc8e7e3dd5 (patch)
treed4dc7716fbdc60c50b4f96a60158e0aa59c51d68
parent51184a774bb7622f0a5b8fa02140ba7275644840 (diff)
downloadmqtt-dirpub-da6bcb151f0465d060ac43c27a6cdcfc8e7e3dd5.tar.bz2
fix call of _fmask()
-rw-r--r--sub_client_output.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sub_client_output.c b/sub_client_output.c
index 19ae025..0c4951e 100644
--- a/sub_client_output.c
+++ b/sub_client_output.c
@@ -621,24 +621,23 @@ static FILE *_mosquitto_fopen(const char *path, const char *mode)
void print_message_file(struct mosq_config *cfg, const struct mosquitto_message *message)
{
-
+
cfg->fmask_topic = message->topic;
FILE *fptr = NULL;
- if(cfg->format == NULL && strlen(cfg->fmask) >= 1) {
+ if(cfg->format && strlen(cfg->fmask) == 0) {
+ _fmask(cfg->format, cfg, message); /* experimental */
+ } else {
_fmask(cfg->fmask, cfg, message);
}
- if(cfg->format && strlen(cfg->fmask) == 0) { /* experimental */
- _fmask(cfg->format, cfg, message);
- }
char *path, *prog;
path = dirname(strdup(cfg->ffmask));
prog = basename(strdup(cfg->ffmask));
-
+
mkpath(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-
+
/* reasonable method to distinguish between directory
* and a writable node (by default is off) */
if(cfg->nodesuffix) {