diff mbox series

[nft,2/2] main: Bail if non-available JSON was requested

Message ID 20190624171038.24672-3-phil@nwl.cc
State Accepted
Delegated to: Pablo Neira
Headers show
Series Improve a few minor JSON glitches | expand

Commit Message

Phil Sutter June 24, 2019, 5:10 p.m. UTC
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).

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/main.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/src/main.c b/src/main.c
index 9a50f30f850b2..cbfd69a42d045 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: