[PATCH 1/2] sftp: Don't attempt to complete arguments for non-existent commands
Michal Privoznik
mprivozn at redhat.com
Sun Jan 16 04:00:24 AEDT 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 8cb5917a..1c529263 100644
--- a/sftp.c
+++ b/sftp.c
@@ -2102,7 +2102,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.34.1
More information about the openssh-unix-dev
mailing list