Skip to content

Commit 57a52a4

Browse files
Fix console hang after exceeding input limit
When the console input exceeds the error limit (five attempts), it displays: "Error limit exceeded. Stopping command execution." However, it does not exit the command prompt. Additionally, attempting to quit using the "quit" command fails, leaving Ctrl+C as the only way to terminate the program, which may lead to memory leaks. This commit fixes the issue by declaring do_quit before record_error and calling it upon reaching the error limit to prevent memory leaks. Change-Id: I52d53f69156bff2ab793afba65b46c67c125671f Co-authored-by: charliechiou <[email protected]>
1 parent b36c6b1 commit 57a52a4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

console.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,15 @@ static char **parse_args(char *line, int *argcp)
160160
return argv;
161161
}
162162

163+
static bool do_quit(int argc, char *argv[]);
163164
static void record_error()
164165
{
165166
err_cnt++;
166167
if (err_cnt >= err_limit) {
167-
report(1, "Error limit exceeded. Stopping command execution");
168-
quit_flag = true;
168+
report(
169+
1,
170+
"Error limit exceeded. Stopping command execution, and quitting");
171+
do_quit(0, NULL);
169172
}
170173
}
171174

0 commit comments

Comments
 (0)