diff options
author | Chet Ramey <chet.ramey@case.edu> | 2019-03-19 10:05:39 -0400 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2019-03-19 10:05:39 -0400 |
commit | fcf6ae7d069a64741e9484cf219d7fe95de9e796 (patch) | |
tree | 076ef4bd5a863e6e286c9deb7b637699d7ac9c5c /pathexp.c | |
parent | ddf3f643cb9b9a2ca8e6d996c605e4332204874c (diff) | |
download | bash-fcf6ae7d069a64741e9484cf219d7fe95de9e796.tar.gz |
Bash-5.0 patch 3: improvements when globbing directory names containing backslashes
Diffstat (limited to 'pathexp.c')
-rw-r--r-- | pathexp.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -65,11 +65,11 @@ unquoted_glob_pattern_p (string) { register int c; char *send; - int open; + int open, bsquote; DECLARE_MBSTATE; - open = 0; + open = bsquote = 0; send = string + strlen (string); while (c = *string++) @@ -100,7 +100,14 @@ unquoted_glob_pattern_p (string) can be removed by the matching engine, so we have to run it through globbing. */ case '\\': - return (*string != 0); + if (*string != '\0' && *string != '/') + { + bsquote = 1; + string++; + continue; + } + else if (*string == 0) + return (0); case CTLESC: if (*string++ == '\0') @@ -117,7 +124,8 @@ unquoted_glob_pattern_p (string) ADVANCE_CHAR_P (string, send - string); #endif } - return (0); + + return (bsquote ? 2 : 0); } /* Return 1 if C is a character that is `special' in a POSIX ERE and needs to |