From dde005ef92190dffd1bab0ddbfcfd8c5dbe17bc8 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 16 Aug 2018 11:06:58 +0100 Subject: [PATCH] Return error in mosquitto_pub -l if compiled without threading. --- client/pub_client.c | 8 ++++++++ config.mk | 1 + 2 files changed, 9 insertions(+) diff --git a/client/pub_client.c b/client/pub_client.c index 85fd73c8..31bcf23a 100644 --- a/client/pub_client.c +++ b/client/pub_client.c @@ -336,6 +336,14 @@ int main(int argc, char *argv[]) password = cfg.password; quiet = cfg.quiet; +#ifndef WITH_THREADING + if(cfg.pub_mode == MSGMODE_STDIN_LINE){ + fprintf(stderr, "Error: '-l' mode not available, threading support has not been compiled in.\n"); + free(buf); + return 1; + } +#endif + if(cfg.pub_mode == MSGMODE_STDIN_FILE){ if(load_stdin()){ fprintf(stderr, "Error loading input from stdin.\n"); diff --git a/config.mk b/config.mk index 01efb996..a8d4914a 100644 --- a/config.mk +++ b/config.mk @@ -194,6 +194,7 @@ endif ifeq ($(WITH_THREADING),yes) LIB_LIBS:=$(LIB_LIBS) -lpthread LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_THREADING + CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_THREADING endif ifeq ($(WITH_SOCKS),yes)