diff options
author | Ron Yorston <rmy@pobox.com> | 2023-03-24 15:16:35 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-03-29 16:45:13 +0200 |
commit | f2e659415ad59906124fca963040c8884746feed (patch) | |
tree | 4aac2f24de50bbc1ad8a6c21b4ef51ce7cba803d | |
parent | a59e5a7d08cb26ec029d00dd11e693765aca17be (diff) | |
download | busybox-w32-f2e659415ad59906124fca963040c8884746feed.tar.gz busybox-w32-f2e659415ad59906124fca963040c8884746feed.tar.bz2 busybox-w32-f2e659415ad59906124fca963040c8884746feed.zip |
lineedit: fix matching of directories when searching PATH
Commit 8baa643a3 (lineedit: match local directories when searching
PATH) included subdirectories of the current directory in the search
when tab-completing commands.
Unfortunately a short time later commit 1d180cd74 (lineedit: use
strncmp instead of is_prefixed_with (we know the length)) broke
this feature by returning an incorrect length for the array of paths.
Fix the length and reinstate matching of subdirectories.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/lineedit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index b942f540a..625884adf 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -825,8 +825,8 @@ static unsigned path_parse(char ***p) | |||
825 | res[npth++] = tmp; | 825 | res[npth++] = tmp; |
826 | } | 826 | } |
827 | /* special case: "match subdirectories of the current directory" */ | 827 | /* special case: "match subdirectories of the current directory" */ |
828 | /*res[npth++] = NULL; - filled by xzalloc() */ | 828 | /*res[npth] = NULL; - filled by xzalloc() */ |
829 | return npth; | 829 | return npth + 1; |
830 | } | 830 | } |
831 | 831 | ||
832 | /* Complete command, directory or file name. | 832 | /* Complete command, directory or file name. |