aboutsummaryrefslogtreecommitdiff
path: root/coreutils/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/test.c')
-rw-r--r--coreutils/test.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/coreutils/test.c b/coreutils/test.c
index 70eac5f6c..fb5778760 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -619,6 +619,29 @@ static int filstat(char *nm, enum token mode)
619 return 0; 619 return 0;
620 } 620 }
621 621
622#if ENABLE_PLATFORM_MINGW32
623 if (mode == FILEX) {
624 int len = strlen(nm), ret;
625 if (len >= 4 &&
626 (!strcmp(nm+len-4,".exe") ||
627 !strcmp(nm+len-4,".com")))
628 ret = stat(nm, &s);
629 else {
630 char *exepath;
631 exepath = malloc(len+5);
632 memcpy(exepath, nm, len);
633 memcpy(exepath+len, ".exe", 5);
634 ret = stat(exepath, &s);
635 if (ret < 0) {
636 memcpy(exepath+len, ".exe", 5);
637 ret = stat(exepath, &s);
638 }
639 free(exepath);
640 }
641 return ret >= 0;
642 }
643#endif
644
622 if (stat(nm, &s) != 0) 645 if (stat(nm, &s) != 0)
623 return 0; 646 return 0;
624 if (mode == FILEXIST) 647 if (mode == FILEXIST)