From 9200bfc50653612033d58774f422fc20150d3301 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 13 Nov 2017 15:08:16 +0100 Subject: libnftables: Unexport enum nftables_exit_codes Apart from SUCCESS/FAILURE, these codes were not used by library functions simply because NOMEM and NONL conditions lead to calling exit() instead of propagating the error condition back up the call stack. Instead, make nft_run_cmd_from_*() return either 0 or -1 on error. Usually errno will then contain more details about what happened and/or there are messages in erec. Calls to exit()/return in main() are adjusted to stay compatible. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/nftables.h | 7 +++++++ include/nftables/nftables.h | 10 ---------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/nftables.h b/include/nftables.h index d69079fe..3bfa33e5 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -35,6 +35,13 @@ struct nft_ctx { uint32_t flags; }; +enum nftables_exit_codes { + NFT_EXIT_SUCCESS = 0, + NFT_EXIT_FAILURE = 1, + NFT_EXIT_NOMEM = 2, + NFT_EXIT_NONL = 3, +}; + struct input_descriptor; struct location { const struct input_descriptor *indesc; diff --git a/include/nftables/nftables.h b/include/nftables/nftables.h index 4211be76..8e59f2b2 100644 --- a/include/nftables/nftables.h +++ b/include/nftables/nftables.h @@ -38,16 +38,6 @@ enum nft_numeric_level { */ #define NFT_CTX_DEFAULT 0 -/** - * Exit codes returned by nft_run_cmd_from_*() - */ -enum nftables_exit_codes { - NFT_EXIT_SUCCESS = 0, - NFT_EXIT_FAILURE = 1, - NFT_EXIT_NOMEM = 2, - NFT_EXIT_NONL = 3, -}; - struct nft_ctx *nft_ctx_new(uint32_t flags); void nft_ctx_free(struct nft_ctx *ctx); -- cgit v1.2.3