From 0b52f7c01f55707b25eebd0a66c48eafe06fe455 Mon Sep 17 00:00:00 2001 From: Inrin Date: Tue, 6 Feb 2024 19:03:14 +0100 Subject: [PATCH] birdc: Do not execute cmd on noninteractive help request The help command triggered by '?' keeps the message in readline buffer, so it could be edited. For noninteractive shell it leads to an unexpected side effect that `echo ? | birdc` executes the command after showing its help. Avoid this by clearing the readline buffer in such case. --- client/birdc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/birdc.c b/client/birdc.c index f1aea2fe..3e4a64f4 100644 --- a/client/birdc.c +++ b/client/birdc.c @@ -136,6 +136,9 @@ input_help(int arg, int key UNUSED) input_start_list(); cmd_help(rl_line_buffer, rl_point); rl_undo_command(1, 0); + /* ? is "internal". Do not submit command in non interactive session */ + if (!interactive) + rl_replace_line("", 0); input_stop_list(); return 0; }