From: Inrin Date: Tue, 6 Feb 2024 18:03:14 +0000 (+0100) Subject: birdc: Do not execute cmd on noninteractive help request X-Git-Tag: v2.15~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b52f7c01f55707b25eebd0a66c48eafe06fe455;p=thirdparty%2Fbird.git 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. --- diff --git a/client/birdc.c b/client/birdc.c index f1aea2fee..3e4a64f4c 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; }