unix: remove uv_fs_stat windows compat hack
uv_fs_stat and uv_fs_lstat removed the trailing backslash (if any) from the path in order to please a test case that was written for Windows. Remove the compatibility hack and fix the test.
This commit is contained in:
parent
678e95a443
commit
7320633c4b
@ -81,16 +81,6 @@
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define PATH_STAT_FIXUP \
|
||||
do { \
|
||||
size_t len; \
|
||||
PATH; \
|
||||
len = strlen((req)->path); \
|
||||
if (len != 0 && (req)->path[len - 1] == '\\') \
|
||||
((char*) (req)->path)[len - 1] = '\0'; /* Windows compatibility... */ \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define POST \
|
||||
do { \
|
||||
if ((cb) != NULL) \
|
||||
@ -474,7 +464,7 @@ int uv_fs_futime(uv_loop_t* loop,
|
||||
|
||||
int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
||||
INIT(LSTAT);
|
||||
PATH_STAT_FIXUP;
|
||||
PATH;
|
||||
POST;
|
||||
}
|
||||
|
||||
@ -589,7 +579,7 @@ int uv_fs_sendfile(uv_loop_t* loop,
|
||||
|
||||
int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
||||
INIT(STAT);
|
||||
PATH_STAT_FIXUP;
|
||||
PATH;
|
||||
POST;
|
||||
}
|
||||
|
||||
|
||||
@ -794,7 +794,7 @@ TEST_IMPL(fs_async_dir) {
|
||||
ASSERT(r == 0);
|
||||
uv_run(loop);
|
||||
|
||||
r = uv_fs_stat(loop, &stat_req, "test_dir\\", stat_cb);
|
||||
r = uv_fs_stat(loop, &stat_req, "test_dir/", stat_cb);
|
||||
ASSERT(r == 0);
|
||||
uv_run(loop);
|
||||
|
||||
@ -802,7 +802,7 @@ TEST_IMPL(fs_async_dir) {
|
||||
ASSERT(r == 0);
|
||||
uv_run(loop);
|
||||
|
||||
r = uv_fs_lstat(loop, &stat_req, "test_dir\\", stat_cb);
|
||||
r = uv_fs_lstat(loop, &stat_req, "test_dir/", stat_cb);
|
||||
ASSERT(r == 0);
|
||||
uv_run(loop);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user