aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-03-09 08:43:43 +0300
committerCem Keylan <cem@ckyln.com>2021-03-09 08:43:43 +0300
commit7ccc9c2432a847b85da5f445977d09f014cbc75b (patch)
tree8067d45ebeea60f1ddaa8167cb1398e2b6631473 /libbb/lineedit.c
parentfef526c380e35cbdc0bdb8375487756c42659a75 (diff)
parent307cd26e9893ed0cf6ee88e7fca2d61d3da0e139 (diff)
downloadbusybox-7ccc9c2432a847b85da5f445977d09f014cbc75b.tar.gz
Merge remote-tracking branch 'upstream/master'HEADmaster
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 367396b91..b0adcf140 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -769,8 +769,6 @@ static unsigned path_parse(char ***p)
if (!tmp)
break;
tmp++;
- if (*tmp == '\0')
- break; /* :<empty> */
npth++;
}
@@ -782,8 +780,6 @@ static unsigned path_parse(char ***p)
if (!tmp)
break;
*tmp++ = '\0'; /* ':' -> '\0' */
- if (*tmp == '\0')
- break; /* :<empty> */
res[npth++] = tmp;
}
/* special case: "match subdirectories of the current directory" */
@@ -854,6 +850,7 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
struct dirent *next;
struct stat st;
char *found;
+ const char *lpath;
if (paths[i] == NULL) { /* path_parse()'s last component? */
/* in PATH completion, current dir's subdir names
@@ -863,7 +860,8 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
paths[i] = (char *)".";
}
- dir = opendir(paths[i]);
+ lpath = *paths[i] ? paths[i] : ".";
+ dir = opendir(lpath);
if (!dir)
continue; /* don't print an error */
@@ -878,7 +876,7 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
if (strncmp(basecmd, name_found, baselen) != 0)
continue; /* no */
- found = concat_path_file(paths[i], name_found);
+ found = concat_path_file(lpath, name_found);
/* NB: stat() first so that we see is it a directory;
* but if that fails, use lstat() so that
* we still match dangling links */