diff options
author | Phil Sutter <phil@nwl.cc> | 2023-06-22 01:10:59 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2023-07-04 13:03:09 +0200 |
commit | 75bfaeb7edd1fc2ae7a72318af808d8b010262b4 (patch) | |
tree | 0471270dd9be78c8f14a0c9c71a72ff8e204b6a3 /include | |
parent | 516a36c8d01fa03aafaf56a7eafa31ec0a9084db (diff) |
cli: Make cli_init() return to caller
Avoid direct exit() calls as that leaves the caller-allocated nft_ctx
object in place. Making sure it is freed helps with valgrind-analyses at
least.
To signal desired exit from CLI, introduce global cli_quit boolean and
make all cli_exit() implementations also set cli_rc variable to the
appropriate return code.
The logic is to finish CLI only if cli_quit is true which asserts proper
cleanup as it is set only by the respective cli_exit() function.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'include')
-rw-r--r-- | include/cli.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/cli.h b/include/cli.h index 609ed2ed..c854948e 100644 --- a/include/cli.h +++ b/include/cli.h @@ -12,6 +12,6 @@ static inline int cli_init(struct nft_ctx *nft) return -1; } #endif -extern void cli_exit(void); +extern void cli_exit(int rc); #endif |