]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
main: Bail if non-available JSON was requested
authorPhil Sutter <phil@nwl.cc>
Mon, 24 Jun 2019 17:10:38 +0000 (19:10 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 25 Jun 2019 00:16:59 +0000 (02:16 +0200)
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 <pablo@netfilter.org>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/main.c

index 9a50f30f850b2ecfaf0fff76e5431647a0713079..cbfd69a42d045fc1b4f1947023f7624d895f5c74 100644 (file)
@@ -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: