summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compat/mingw.c8
-rwxr-xr-xt/t0060-path-utils.sh2
2 files changed, 7 insertions, 3 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 2136744af3..f2c94f9d08 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2590,12 +2590,14 @@ not_a_reserved_name:
continue;
}
break;
- case 'c': case 'C': /* COM<N>, CON, CONIN$, CONOUT$ */
+ case 'c': case 'C':
+ /* COM1 ... COM9, CON, CONIN$, CONOUT$ */
if ((c = path[++i]) != 'o' && c != 'O')
goto not_a_reserved_name;
c = path[++i];
- if (c == 'm' || c == 'M') { /* COM<N> */
- if (!isdigit(path[++i]))
+ if (c == 'm' || c == 'M') { /* COM1 ... COM9 */
+ c = path[++i];
+ if (c < '1' || c > '9')
goto not_a_reserved_name;
} else if (c == 'n' || c == 'N') { /* CON */
c = path[i + 1];
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index 2ea2d00c39..56db5c8aba 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -476,6 +476,7 @@ test_expect_success MINGW 'is_valid_path() on Windows' '
C:\\git \
comm \
conout.c \
+ com0.c \
lptN \
\
--not \
@@ -488,6 +489,7 @@ test_expect_success MINGW 'is_valid_path() on Windows' '
"AUX.c" \
"abc/conOut\$ .xyz/test" \
lpt8 \
+ com9.c \
"lpt*" \
Nul \
"PRN./abc"