From 6eb8bcc165c9e7b3e67857252b15bb0eed36e0c9 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 24 Jun 2019 19:10:38 +0200 Subject: main: Bail if non-available JSON was requested If user passes '-j' flag, falling back to standard syntax output probably causes more harm than good so instead print an error message and exit(1). Suggested-by: Pablo Neira Ayuso Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- src/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.c b/src/main.c index 9a50f30f..cbfd69a4 100644 --- a/src/main.c +++ b/src/main.c @@ -277,6 +277,9 @@ int main(int argc, char * const *argv) case OPT_JSON: #ifdef HAVE_LIBJANSSON output_flags |= NFT_CTX_OUTPUT_JSON; +#else + fprintf(stderr, "JSON support not compiled-in\n"); + exit(EXIT_FAILURE); #endif break; case OPT_GUID: -- cgit v1.2.3