diff options
author | Ron Yorston <rmy@pobox.com> | 2015-03-24 08:27:45 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-03-24 08:27:45 +0000 |
commit | 538a16d15016b9be9885e94e9b94a4cbfb760501 (patch) | |
tree | dfbde972f95e05e0557ffd45bb5bd050a150e98f /win32 | |
parent | f2cfa8d515d7c7f594ced5bfe748a5b5773590cb (diff) | |
download | busybox-w32-538a16d15016b9be9885e94e9b94a4cbfb760501.tar.gz busybox-w32-538a16d15016b9be9885e94e9b94a4cbfb760501.tar.bz2 busybox-w32-538a16d15016b9be9885e94e9b94a4cbfb760501.zip |
test: fix access check bug; tweak fake file mode
Changing the fake uid from 0 to 1000 uncovered a problem with file
access checks in test. Previously the tests were short-circuited
because it thought we were root. With a non-root user the tests
were performed, but the mode bits had been redefined for WIN32.
Also adjust the fake file mode returned by stat so that the user
and group modes are identical. Other users have the same modes
as user but without write permission.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 4b5701b2d..fe45589c2 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -228,6 +228,7 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf) | |||
228 | { | 228 | { |
229 | int err; | 229 | int err; |
230 | WIN32_FILE_ATTRIBUTE_DATA fdata; | 230 | WIN32_FILE_ATTRIBUTE_DATA fdata; |
231 | mode_t usermode; | ||
231 | 232 | ||
232 | if (!(err = get_file_attr(file_name, &fdata))) { | 233 | if (!(err = get_file_attr(file_name, &fdata))) { |
233 | int len = strlen(file_name); | 234 | int len = strlen(file_name); |
@@ -265,6 +266,8 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf) | |||
265 | FindClose(handle); | 266 | FindClose(handle); |
266 | } | 267 | } |
267 | } | 268 | } |
269 | usermode = buf->st_mode & S_IRWXU; | ||
270 | buf->st_mode |= (usermode >> 3) | ((usermode >> 6) & ~S_IWOTH); | ||
268 | 271 | ||
269 | /* | 272 | /* |
270 | * Assume a block is 4096 bytes and calculate number of 512 byte | 273 | * Assume a block is 4096 bytes and calculate number of 512 byte |