diff options
| author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-22 22:32:48 +1000 |
|---|---|---|
| committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-23 04:44:38 +1000 |
| commit | d20aaa26a9aff415552e7bb30560d614ae21cd2b (patch) | |
| tree | daafc49c368c1d3c3dcfc76c073f9f76eb5faa3d | |
| parent | df9141a4384f3a85c31b1f35fd76c9260776c254 (diff) | |
| download | busybox-w32-d20aaa26a9aff415552e7bb30560d614ae21cd2b.tar.gz busybox-w32-d20aaa26a9aff415552e7bb30560d614ae21cd2b.tar.bz2 busybox-w32-d20aaa26a9aff415552e7bb30560d614ae21cd2b.zip | |
coreutils/test: "test -x foo.exe" should return true
| -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 a635b1735..f9b872f1d 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
| @@ -398,6 +398,24 @@ static int filstat(char *nm, enum token mode) | |||
| 398 | return 0; | 398 | return 0; |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | #ifdef __MINGW32__ | ||
| 402 | if (mode == FILEX) { | ||
| 403 | int len = strlen(nm), ret; | ||
| 404 | char *exepath; | ||
| 405 | if (len >= 4 && !strcmp(nm+len-4,".exe")) | ||
| 406 | exepath = nm; | ||
| 407 | else { | ||
| 408 | exepath = malloc(len+5); | ||
| 409 | memcpy(exepath, nm, len); | ||
| 410 | memcpy(exepath+len, ".exe", 5); | ||
| 411 | } | ||
| 412 | ret = stat(exepath, &s); | ||
| 413 | if (exepath != nm) | ||
| 414 | free(exepath); | ||
| 415 | return ret >= 0; | ||
| 416 | } | ||
| 417 | #endif | ||
| 418 | |||
| 401 | if (stat(nm, &s) != 0) | 419 | if (stat(nm, &s) != 0) |
| 402 | return 0; | 420 | return 0; |
| 403 | if (mode == FILEXIST) | 421 | if (mode == FILEXIST) |
