[PATCH v2 1/2] sftp: Don't attempt to complete arguments for non-existent commands
Michal Privoznik
mprivozn at redhat.com
Tue Sep 13 00:17:11 AEST 2022
If user entered a non-existent command (e.g. because they made a
typo) there is no point in trying to complete its arguments. Skip
calling complete_match() if that's the case.
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
sftp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sftp.c b/sftp.c
index 939b8dc0..70e8d344 100644
--- a/sftp.c
+++ b/sftp.c
@@ -2143,7 +2143,7 @@ complete(EditLine *el, int ch)
if (carg > 1 && line[cursor-1] != ' ')
filematch = argv[carg - 1];
- if (remote != 0 &&
+ if ((remote == REMOTE || remote == LOCAL) &&
complete_match(el, complete_ctx->conn,
*complete_ctx->remote_pathp, filematch,
remote, carg == argc, quote, terminated) != 0)
--
2.35.1
More information about the openssh-unix-dev
mailing list