summaryrefslogtreecommitdiffstats
path: root/usr.bin/which/which.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/which/which.c')
-rw-r--r--usr.bin/which/which.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/which/which.c b/usr.bin/which/which.c
index cea0ce6..11f43fc 100644
--- a/usr.bin/which/which.c
+++ b/usr.bin/which/which.c
@@ -126,13 +126,15 @@ static int
print_matches(char *path, char *filename)
{
char candidate[PATH_MAX];
- char *d;
+ const char *d;
int found;
if (*filename == '/')
return (is_there(filename) ? 0 : -1);
found = 0;
while ((d = strsep(&path, ":")) != NULL) {
+ if (*d == '\0')
+ d = ".";
if (snprintf(candidate, sizeof(candidate), "%s/%s", d,
filename) >= (int)sizeof(candidate))
continue;
OpenPOWER on IntegriCloud