aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-12-10 14:44:57 +0000
committerDenys Vlasenko <vda.linux@googlemail.com>2020-12-16 09:38:18 +0100
commit8506dd673030539b2890dd617f885ec20f1e8a7d (patch)
tree8248d579b725cab896bbd108cc5230abee1398e7 /libbb
parentcaba1a16ec4a883376d53e5921917bb8485b5f49 (diff)
downloadbusybox-8506dd673030539b2890dd617f885ec20f1e8a7d.tar.gz
lineedit: omit directories when tab-completing from PATH
Only files should be matched when using PATH for tab-completion. function old new delta complete_cmd_dir_file 883 894 +11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 11/0) Total: 11 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/lineedit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index a3b798e3f..d64d7d0c2 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -871,6 +871,9 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
strcpy(found, name_found);
if (S_ISDIR(st.st_mode)) {
+ /* skip directories if searching PATH */
+ if (type == FIND_EXE_ONLY && !dirbuf)
+ goto cont;
/* name is a directory, add slash */
found[len] = '/';
found[len + 1] = '\0';