fsck: limit history list length

Add a hard limit to prevent the history command list from growing
unnecessarily large, especially when interactive fsck is automated
with scripting.
This commit is contained in:
CismonX 2025-02-26 14:46:29 +08:00
parent 0fd2cbbc9d
commit b33f2ced0b
No known key found for this signature in database
GPG key ID: 3094873E29A482FB

View file

@ -43,6 +43,10 @@
#include "lib.h"
#include "xstd.h"
#ifndef BOOKMARKFS_FSCK_RL_HISTORY_MAX
# define BOOKMARKFS_FSCK_RL_HISTORY_MAX 256
#endif
struct fsck_ctx {
struct bookmarkfs_fsck_ops const *ops;
struct bookmarkfs_fsck_handler const *handler;
@ -107,6 +111,7 @@ init_readline (
rl_initialize();
using_history();
stifle_history(BOOKMARKFS_FSCK_RL_HISTORY_MAX);
return 0;
}