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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 src/main.c | 3 +++
 1 file changed, 3 insertions(+)

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:
-- 
2.21.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux