From b3129dcb497732f827c56666617b0744bcab1315 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Tue, 14 Sep 2010 11:02:01 +1000 Subject: win32: test: support .com executables --- coreutils/test.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/coreutils/test.c b/coreutils/test.c index b523671df..3115ce6e7 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -602,17 +602,22 @@ static int filstat(char *nm, enum token mode) #if ENABLE_PLATFORM_MINGW32 if (mode == FILEX) { int len = strlen(nm), ret; - char *exepath; - if (len >= 4 && !strcmp(nm+len-4,".exe")) - exepath = nm; + if (len >= 4 && + (!strcmp(nm+len-4,".exe") || + !strcmp(nm+len-4,".com"))) + ret = stat(nm, &s); else { + char *exepath; exepath = malloc(len+5); memcpy(exepath, nm, len); memcpy(exepath+len, ".exe", 5); - } - ret = stat(exepath, &s); - if (exepath != nm) + ret = stat(exepath, &s); + if (ret < 0) { + memcpy(exepath+len, ".exe", 5); + ret = stat(exepath, &s); + } free(exepath); + } return ret >= 0; } #endif -- cgit v1.2.3-55-g6feb