Missing call to cli_exit() to save the history when ctrl-d is pressed in
nft -i.
Moreover, remove call to rl_callback_handler_remove() in cli_exit() for
editline cli since it does not call rl_callback_handler_install().
Fixes: bc2d5f79c2ea ("cli: use plain readline() interface with libedit")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
nft_run_cmd_from_buffer(cli_nft, line);
free(line);
}
-
-void cli_exit(void)
-{
- rl_callback_handler_remove();
- rl_deprep_terminal();
- write_history(histfile);
-}
#endif
#if defined(HAVE_LIBREADLINE)
return 0;
}
+void cli_exit(void)
+{
+ rl_callback_handler_remove();
+ rl_deprep_terminal();
+ write_history(histfile);
+}
+
#elif defined(HAVE_LIBEDIT)
int cli_init(struct nft_ctx *nft)
cli_complete(line);
}
+ cli_exit();
return 0;
}
+void cli_exit(void)
+{
+ rl_deprep_terminal();
+ write_history(histfile);
+}
+
#else /* HAVE_LINENOISE */
int cli_init(struct nft_ctx *nft)