aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-03-24 15:02:22 +0000
committerRon Yorston <rmy@pobox.com>2023-03-24 15:17:37 +0000
commit6d39c658a05b8dbd7ead0b9cfd38476c15041fc0 (patch)
tree8d780cb9cf1f13381bd9f39b82192589c1136c12 /libbb
parentf491e57d1ce04ec8124b9605268e5ecd3b1fb489 (diff)
downloadbusybox-w32-6d39c658a05b8dbd7ead0b9cfd38476c15041fc0.tar.gz
busybox-w32-6d39c658a05b8dbd7ead0b9cfd38476c15041fc0.tar.bz2
busybox-w32-6d39c658a05b8dbd7ead0b9cfd38476c15041fc0.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>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/lineedit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 9bf2f89a5..9220ddeb3 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -890,8 +890,8 @@ static unsigned path_parse(char ***p)
890 res[npth++] = tmp; 890 res[npth++] = tmp;
891 } 891 }
892 /* special case: "match subdirectories of the current directory" */ 892 /* special case: "match subdirectories of the current directory" */
893 /*res[npth++] = NULL; - filled by xzalloc() */ 893 /*res[npth] = NULL; - filled by xzalloc() */
894 return npth; 894 return npth + 1;
895} 895}
896 896
897/* Complete command, directory or file name. 897/* Complete command, directory or file name.