diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-02-09 20:10:42 +0700 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-02-09 20:13:20 +0700 |
commit | 4713c7fb769e8e627459394291310c9a335fbbdb (patch) | |
tree | 5ac4e41e09536fbc2d6ef277b53e91f62dd37e27 | |
parent | a00a64033c7e9e4d72d3bb6fdb290f0170caa13a (diff) | |
download | busybox-w32-4713c7fb769e8e627459394291310c9a335fbbdb.tar.gz busybox-w32-4713c7fb769e8e627459394291310c9a335fbbdb.tar.bz2 busybox-w32-4713c7fb769e8e627459394291310c9a335fbbdb.zip |
win32: test: make -r/-w work
R_OK and W_OK on Windows are defined as 4 and 2 respectively. The
stat() reimplementation uses S_IREAD and S_IWRITE, which are
completely different value.
Redefine R_OK and W_OK
-rw-r--r-- | coreutils/test.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/coreutils/test.c b/coreutils/test.c index 3e9ab7c65..caecd7d02 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -620,6 +620,10 @@ static int filstat(char *nm, enum token mode) | |||
620 | } | 620 | } |
621 | 621 | ||
622 | #if ENABLE_PLATFORM_MINGW32 | 622 | #if ENABLE_PLATFORM_MINGW32 |
623 | #undef R_OK | ||
624 | #define R_OK S_IREAD | ||
625 | #undef W_OK | ||
626 | #define W_OK S_IWRITE | ||
623 | if (mode == FILEX) { | 627 | if (mode == FILEX) { |
624 | int len = strlen(nm), ret; | 628 | int len = strlen(nm), ret; |
625 | if (len >= 4 && | 629 | if (len >= 4 && |