Skip to content

Commit

Permalink
Fix bug in fcomplete when pattern does not match any file.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Jul 27, 2017
1 parent 3b5f627 commit 0f6d609
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ obj/**
release/**
unicode/**
*.cache
*.old
NEWS
README
configure
Expand Down
12 changes: 7 additions & 5 deletions filename.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ fcomplete(s)
char *s;
{
char *fpat;
char *qs;

if (secure)
return (NULL);
Expand Down Expand Up @@ -431,18 +432,19 @@ fcomplete(s)
SNPRINTF1(fpat, len, "%s*", s);
}
#endif
s = lglob(fpat);
qs = lglob(fpat);
s = shell_unquote(qs);
if (strcmp(s,fpat) == 0)
{
/*
* The filename didn't expand.
*/
free(s);
free(fpat);
return (NULL);
free(qs);
qs = NULL;
}
free(s);
free(fpat);
return (s);
return (qs);
}
#endif

Expand Down

0 comments on commit 0f6d609

Please sign in to comment.