summaryrefslogtreecommitdiff
path: root/pathexp.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2020-09-09 15:25:32 -0400
committerChet Ramey <chet.ramey@case.edu>2020-09-09 15:25:32 -0400
commit3eb0018e75b74bb886df7fba4b1712529ce7258f (patch)
tree13b53713ef8f483a82295324e314da48b59c9346 /pathexp.c
parent712f80b0a49c3a0227d0b52bff5e0b763747697e (diff)
downloadbash-5.1-beta.tar.gz
bash-5.1 beta releasebash-5.1-beta
Diffstat (limited to 'pathexp.c')
-rw-r--r--pathexp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/pathexp.c b/pathexp.c
index 1e4060ff..6e7ef283 100644
--- a/pathexp.c
+++ b/pathexp.c
@@ -528,10 +528,18 @@ glob_name_is_acceptable (name)
const char *name;
{
struct ign *p;
+ char *n;
int flags;
- /* . and .. are never matched */
- if (name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')))
+ /* . and .. are never matched. We extend this to the terminal component of a
+ pathname. */
+ n = strrchr (name, '/');
+ if (n == 0 || n[1] == 0)
+ n = (char *)name;
+ else
+ n++;
+
+ if (n[0] == '.' && (n[1] == '\0' || (n[1] == '.' && n[2] == '\0')))
return (0);
flags = FNM_PATHNAME | FNMATCH_EXTFLAG | FNMATCH_NOCASEGLOB;