diff options
-rw-r--r-- | coreutils/test.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/coreutils/test.c b/coreutils/test.c index 5864c7f32..b523671df 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -599,6 +599,24 @@ static int filstat(char *nm, enum token mode) | |||
599 | return 0; | 599 | return 0; |
600 | } | 600 | } |
601 | 601 | ||
602 | #if ENABLE_PLATFORM_MINGW32 | ||
603 | if (mode == FILEX) { | ||
604 | int len = strlen(nm), ret; | ||
605 | char *exepath; | ||
606 | if (len >= 4 && !strcmp(nm+len-4,".exe")) | ||
607 | exepath = nm; | ||
608 | else { | ||
609 | exepath = malloc(len+5); | ||
610 | memcpy(exepath, nm, len); | ||
611 | memcpy(exepath+len, ".exe", 5); | ||
612 | } | ||
613 | ret = stat(exepath, &s); | ||
614 | if (exepath != nm) | ||
615 | free(exepath); | ||
616 | return ret >= 0; | ||
617 | } | ||
618 | #endif | ||
619 | |||
602 | if (stat(nm, &s) != 0) | 620 | if (stat(nm, &s) != 0) |
603 | return 0; | 621 | return 0; |
604 | if (mode == FILEXIST) | 622 | if (mode == FILEXIST) |