summaryrefslogtreecommitdiff
path: root/deps/uv
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv')
-rw-r--r--deps/uv/src/unix/eio/eio.c12
-rw-r--r--deps/uv/src/unix/fs.c20
-rw-r--r--deps/uv/src/win/fs.c59
-rw-r--r--deps/uv/test/test-fs.c89
-rw-r--r--deps/uv/test/test-list.h1
5 files changed, 104 insertions, 77 deletions
diff --git a/deps/uv/src/unix/eio/eio.c b/deps/uv/src/unix/eio/eio.c
index 74153ad164..a005db5d3b 100644
--- a/deps/uv/src/unix/eio/eio.c
+++ b/deps/uv/src/unix/eio/eio.c
@@ -1812,17 +1812,7 @@ eio__scandir (eio_req *req, etp_worker *self)
#endif
if (req->flags & EIO_FLAG_PTR1_FREE)
- {
- req->flags &= ~EIO_FLAG_PTR1_FREE;
- free (req->ptr1);
- req->ptr1 = NULL;
- }
-
- if (!dirp)
- {
- req->errorno = errno;
- return;
- }
+ free (req->ptr1);
req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE;
req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0;
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
index 60f5e59d7a..9f15db837f 100644
--- a/deps/uv/src/unix/fs.c
+++ b/deps/uv/src/unix/fs.c
@@ -55,8 +55,8 @@
req->result = func(args); \
if (req->result) { \
uv_err_new(loop, errno); \
- return -1; \
} \
+ return req->result; \
} \
return 0;
@@ -116,6 +116,9 @@ static int uv__fs_after(eio_req* eio) {
switch (req->fs_type) {
case UV_FS_READDIR:
+ if (req->eio->result == -1)
+ break; /* opendir() or readdir() operation failed. */
+
/*
* XXX This is pretty bad.
* We alloc and copy the large null terminated string list from libeio.
@@ -123,8 +126,6 @@ static int uv__fs_after(eio_req* eio) {
* callback. We must keep it until uv_fs_req_cleanup. If we get rid of
* libeio this can be avoided.
*/
- if (req->eio->ptr2 == NULL)
- break;
buflen = 0;
name = req->eio->ptr2;
for (i = 0; i < req->result; i++) {
@@ -203,6 +204,8 @@ int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
}
uv__cloexec(req->result, 1);
+
+ return req->result;
}
return 0;
@@ -234,6 +237,8 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf,
uv_err_new(loop, errno);
return -1;
}
+
+ return req->result;
}
return 0;
@@ -269,6 +274,8 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
uv_err_new(loop, errno);
return -1;
}
+
+ return req->result;
}
return 0;
@@ -341,6 +348,8 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
req->result = -1;
return -1;
}
+
+ return req->result;
}
return 0;
@@ -387,6 +396,7 @@ int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
}
req->ptr = &req->statbuf;
+ return req->result;
}
return 0;
@@ -416,6 +426,7 @@ int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
}
req->ptr = &req->statbuf;
+ return req->result;
}
return 0;
@@ -546,6 +557,7 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
}
req->ptr = &req->statbuf;
+ return req->result;
}
return 0;
@@ -611,7 +623,7 @@ int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
req->ptr = buf;
}
- return 0;
+ return req->result;
}
assert(0 && "unreachable");
diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
index b1952056bf..93fa5eb36b 100644
--- a/deps/uv/src/win/fs.c
+++ b/deps/uv/src/win/fs.c
@@ -133,7 +133,6 @@ static void uv_fs_req_init_sync(uv_loop_t* loop, uv_fs_t* req,
void fs__open(uv_fs_t* req, const char* path, int flags, int mode) {
DWORD access;
DWORD share;
- SECURITY_ATTRIBUTES sa;
DWORD disposition;
DWORD attributes;
HANDLE file;
@@ -168,14 +167,6 @@ void fs__open(uv_fs_t* req, const char* path, int flags, int mode) {
*/
share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
- sa.nLength = sizeof(SECURITY_ATTRIBUTES);
- sa.lpSecurityDescriptor = NULL;
- if (flags & _O_NOINHERIT) {
- sa.bInheritHandle = FALSE;
- } else {
- sa.bInheritHandle = TRUE;
- }
-
switch (flags & (_O_CREAT | _O_EXCL | _O_TRUNC)) {
case 0:
case _O_EXCL:
@@ -233,7 +224,7 @@ void fs__open(uv_fs_t* req, const char* path, int flags, int mode) {
file = CreateFileA(path,
access,
share,
- &sa,
+ NULL,
disposition,
attributes,
NULL);
@@ -407,7 +398,6 @@ void fs__readdir(uv_fs_t* req, const char* path, int flags) {
req->ptr = buf;
req->flags |= UV_FS_FREE_PTR;
-done:
SET_REQ_RESULT(req, result);
}
@@ -605,6 +595,8 @@ void fs__readlink(uv_fs_t* req, const char* path) {
DWORD bytes_returned;
REPARSE_DATA_BUFFER* reparse_data;
int utf8size;
+ wchar_t* substitute_name;
+ int substitute_name_length;
symlink = CreateFileA(path,
0,
@@ -648,8 +640,17 @@ void fs__readlink(uv_fs_t* req, const char* path) {
goto done;
}
- utf8size = uv_utf16_to_utf8(reparse_data->SymbolicLinkReparseBuffer.PathBuffer + (reparse_data->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(wchar_t)),
- reparse_data->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(wchar_t),
+ substitute_name = reparse_data->SymbolicLinkReparseBuffer.PathBuffer + (reparse_data->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(wchar_t));
+ substitute_name_length = reparse_data->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(wchar_t);
+
+ /* Strip off the leading \??\ from the substitute name buffer.*/
+ if (memcmp(substitute_name, L"\\??\\", 8) == 0) {
+ substitute_name += 4;
+ substitute_name_length -= 4;
+ }
+
+ utf8size = uv_utf16_to_utf8(substitute_name,
+ substitute_name_length,
NULL,
0);
if (!utf8size) {
@@ -663,10 +664,8 @@ void fs__readlink(uv_fs_t* req, const char* path) {
uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
}
- req->flags |= UV_FS_FREE_PTR;
-
- utf8size = uv_utf16_to_utf8(reparse_data->SymbolicLinkReparseBuffer.PathBuffer + (reparse_data->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(wchar_t)),
- reparse_data->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(wchar_t),
+ utf8size = uv_utf16_to_utf8(substitute_name,
+ substitute_name_length,
req->ptr,
utf8size);
if (!utf8size) {
@@ -675,6 +674,7 @@ void fs__readlink(uv_fs_t* req, const char* path) {
goto done;
}
+ req->flags |= UV_FS_FREE_PTR;
((char*)req->ptr)[utf8size] = '\0';
result = 0;
@@ -805,6 +805,7 @@ int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
uv_fs_req_init_sync(loop, req, UV_FS_OPEN);
fs__open(req, path, flags, mode);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -820,6 +821,7 @@ int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_fs_req_init_sync(loop, req, UV_FS_CLOSE);
fs__close(req, file);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -836,6 +838,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
uv_fs_req_init_sync(loop, req, UV_FS_READ);
fs__read(req, file, buf, length, offset);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -852,6 +855,7 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
uv_fs_req_init_sync(loop, req, UV_FS_WRITE);
fs__write(req, file, buf, length, offset);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -867,6 +871,7 @@ int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_req_init_sync(loop, req, UV_FS_UNLINK);
fs__unlink(req, path);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -883,6 +888,7 @@ int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
uv_fs_req_init_sync(loop, req, UV_FS_MKDIR);
fs__mkdir(req, path, mode);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -897,6 +903,7 @@ int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
uv_fs_req_init_sync(loop, req, UV_FS_RMDIR);
fs__rmdir(req, path);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -913,6 +920,7 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
uv_fs_req_init_sync(loop, req, UV_FS_READDIR);
fs__readdir(req, path, flags);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -930,6 +938,7 @@ int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_req_init_sync(loop, req, UV_FS_LINK);
fs__link(req, path, new_path);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -947,6 +956,7 @@ int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_req_init_sync(loop, req, UV_FS_SYMLINK);
fs__symlink(req, path, new_path, flags);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -962,6 +972,7 @@ int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_req_init_sync(loop, req, UV_FS_READLINK);
fs__readlink(req, path);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -978,6 +989,7 @@ int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, int uid,
uv_fs_req_init_sync(loop, req, UV_FS_CHOWN);
fs__nop(req);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -994,6 +1006,7 @@ int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file, int uid,
uv_fs_req_init_sync(loop, req, UV_FS_FCHOWN);
fs__nop(req);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1030,6 +1043,7 @@ int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(path2);
}
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1067,6 +1081,7 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(path2);
}
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1082,6 +1097,7 @@ int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_fs_req_init_sync(loop, req, UV_FS_FSTAT);
fs__fstat(req, file);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1099,6 +1115,7 @@ int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_req_init_sync(loop, req, UV_FS_RENAME);
fs__rename(req, path, new_path);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1114,6 +1131,7 @@ int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_fs_req_init_sync(loop, req, UV_FS_FDATASYNC);
fs__fsync(req, file);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1129,6 +1147,7 @@ int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_fs_req_init_sync(loop, req, UV_FS_FSYNC);
fs__fsync(req, file);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1145,6 +1164,7 @@ int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file,
uv_fs_req_init_sync(loop, req, UV_FS_FTRUNCATE);
fs__ftruncate(req, file, offset);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1161,6 +1181,7 @@ int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd,
uv_fs_req_init_sync(loop, req, UV_FS_SENDFILE);
fs__sendfile(req, out_fd, in_fd, in_offset, length);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1177,6 +1198,7 @@ int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
uv_fs_req_init_sync(loop, req, UV_FS_CHMOD);
fs__chmod(req, path, mode);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1193,6 +1215,7 @@ int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file, int mode,
uv_fs_req_init_sync(loop, req, UV_FS_FCHMOD);
fs__fchmod(req, file, mode);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1210,6 +1233,7 @@ int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime,
uv_fs_req_init_sync(loop, req, UV_FS_UTIME);
fs__utime(req, path, atime, mtime);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
@@ -1228,6 +1252,7 @@ int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime,
uv_fs_req_init_sync(loop, req, UV_FS_FUTIME);
fs__futime(req, file, atime, mtime);
SET_UV_LAST_ERROR_FROM_REQ(req);
+ return req->result;
}
return 0;
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 99415c69f4..0c115c1952 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -390,7 +390,7 @@ TEST_IMPL(fs_file_noent) {
loop = uv_default_loop();
r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r == -1);
ASSERT(req.result == -1);
ASSERT(uv_last_error(loop).code == UV_ENOENT);
uv_fs_req_cleanup(&req);
@@ -541,68 +541,68 @@ TEST_IMPL(fs_file_sync) {
r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(open_req1.result != -1);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_write(loop, &write_req, open_req1.result, test_buf,
sizeof(test_buf), -1, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(write_req.result != -1);
uv_fs_req_cleanup(&write_req);
r = uv_fs_close(loop, &close_req, open_req1.result, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(close_req.result != -1);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(loop, &open_req1, "test_file", O_RDWR, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(open_req1.result != -1);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_read(loop, &read_req, open_req1.result, buf, sizeof(buf), -1,
NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(read_req.result != -1);
ASSERT(strcmp(buf, test_buf) == 0);
uv_fs_req_cleanup(&read_req);
r = uv_fs_ftruncate(loop, &ftruncate_req, open_req1.result, 7, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(ftruncate_req.result != -1);
uv_fs_req_cleanup(&ftruncate_req);
r = uv_fs_close(loop, &close_req, open_req1.result, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(close_req.result != -1);
uv_fs_req_cleanup(&close_req);
r = uv_fs_rename(loop, &rename_req, "test_file", "test_file2", NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(rename_req.result != -1);
uv_fs_req_cleanup(&rename_req);
r = uv_fs_open(loop, &open_req1, "test_file2", O_RDONLY, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(open_req1.result != -1);
uv_fs_req_cleanup(&open_req1);
memset(buf, 0, sizeof(buf));
r = uv_fs_read(loop, &read_req, open_req1.result, buf, sizeof(buf), -1,
NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(read_req.result != -1);
ASSERT(strcmp(buf, "test-bu") == 0);
uv_fs_req_cleanup(&read_req);
r = uv_fs_close(loop, &close_req, open_req1.result, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(close_req.result != -1);
uv_fs_req_cleanup(&close_req);
r = uv_fs_unlink(loop, &unlink_req, "test_file2", NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(unlink_req.result != -1);
uv_fs_req_cleanup(&unlink_req);
@@ -633,7 +633,7 @@ TEST_IMPL(fs_async_dir) {
/* Create 2 files synchronously. */
r = uv_fs_open(loop, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_close(loop, &close_req, open_req1.result, NULL);
ASSERT(r == 0);
@@ -641,7 +641,7 @@ TEST_IMPL(fs_async_dir) {
r = uv_fs_open(loop, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_close(loop, &close_req, open_req1.result, NULL);
ASSERT(r == 0);
@@ -655,6 +655,7 @@ TEST_IMPL(fs_async_dir) {
/* sync uv_fs_readdir */
r = uv_fs_readdir(loop, &readdir_req, "test_dir", 0, NULL);
+ ASSERT(r == 2);
ASSERT(readdir_req.result == 2);
ASSERT(readdir_req.ptr);
ASSERT(memcmp(readdir_req.ptr, "file1\0file2\0", 12) == 0
@@ -708,6 +709,8 @@ TEST_IMPL(fs_async_sendfile) {
int f, r;
struct stat s1, s2;
+ loop = uv_default_loop();
+
/* Setup. */
unlink("test_file");
unlink("test_file2");
@@ -728,16 +731,14 @@ TEST_IMPL(fs_async_sendfile) {
ASSERT(r == 0);
/* Test starts here. */
- loop = uv_default_loop();
-
r = uv_fs_open(loop, &open_req1, "test_file", O_RDWR, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(open_req1.result != -1);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_open(loop, &open_req2, "test_file2", O_WRONLY | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(open_req2.result != -1);
uv_fs_req_cleanup(&open_req2);
@@ -780,13 +781,13 @@ TEST_IMPL(fs_fstat) {
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
file = req.result;
uv_fs_req_cleanup(&req);
r = uv_fs_write(loop, &req, file, test_buf, sizeof(test_buf), -1, NULL);
- ASSERT(r == 0);
+ ASSERT(r == sizeof(test_buf));
ASSERT(req.result == sizeof(test_buf));
uv_fs_req_cleanup(&req);
@@ -834,13 +835,13 @@ TEST_IMPL(fs_chmod) {
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
file = req.result;
uv_fs_req_cleanup(&req);
r = uv_fs_write(loop, &req, file, test_buf, sizeof(test_buf), -1, NULL);
- ASSERT(r == 0);
+ ASSERT(r == sizeof(test_buf));
ASSERT(req.result == sizeof(test_buf));
uv_fs_req_cleanup(&req);
@@ -921,7 +922,7 @@ TEST_IMPL(fs_chown) {
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
file = req.result;
uv_fs_req_cleanup(&req);
@@ -980,13 +981,13 @@ TEST_IMPL(fs_link) {
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
file = req.result;
uv_fs_req_cleanup(&req);
r = uv_fs_write(loop, &req, file, test_buf, sizeof(test_buf), -1, NULL);
- ASSERT(r == 0);
+ ASSERT(r == sizeof(test_buf));
ASSERT(req.result == sizeof(test_buf));
uv_fs_req_cleanup(&req);
@@ -999,14 +1000,14 @@ TEST_IMPL(fs_link) {
uv_fs_req_cleanup(&req);
r = uv_fs_open(loop, &req, "test_file_link", O_RDWR, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
link = req.result;
uv_fs_req_cleanup(&req);
memset(buf, 0, sizeof(buf));
r = uv_fs_read(loop, &req, link, buf, sizeof(buf), 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
ASSERT(strcmp(buf, test_buf) == 0);
@@ -1019,14 +1020,14 @@ TEST_IMPL(fs_link) {
ASSERT(link_cb_count == 1);
r = uv_fs_open(loop, &req, "test_file_link2", O_RDWR, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
link = req.result;
uv_fs_req_cleanup(&req);
memset(buf, 0, sizeof(buf));
r = uv_fs_read(loop, &req, link, buf, sizeof(buf), 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
ASSERT(strcmp(buf, test_buf) == 0);
@@ -1064,13 +1065,13 @@ TEST_IMPL(fs_symlink) {
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
S_IWRITE | S_IREAD, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
file = req.result;
uv_fs_req_cleanup(&req);
r = uv_fs_write(loop, &req, file, test_buf, sizeof(test_buf), -1, NULL);
- ASSERT(r == 0);
+ ASSERT(r == sizeof(test_buf));
ASSERT(req.result == sizeof(test_buf));
uv_fs_req_cleanup(&req);
@@ -1078,9 +1079,8 @@ TEST_IMPL(fs_symlink) {
/* sync symlink */
r = uv_fs_symlink(loop, &req, "test_file", "test_file_symlink", 0, NULL);
- ASSERT(r == 0);
#ifdef _WIN32
- if (req.result == -1) {
+ if (r == -1) {
if (req.errorno == ENOSYS) {
/*
* Windows doesn't support symlinks on older versions.
@@ -1096,27 +1096,28 @@ TEST_IMPL(fs_symlink) {
}
}
#endif
+ ASSERT(r == 0);
ASSERT(req.result == 0);
uv_fs_req_cleanup(&req);
r = uv_fs_open(loop, &req, "test_file_symlink", O_RDWR, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
link = req.result;
uv_fs_req_cleanup(&req);
memset(buf, 0, sizeof(buf));
r = uv_fs_read(loop, &req, link, buf, sizeof(buf), 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
ASSERT(strcmp(buf, test_buf) == 0);
close(link);
r = uv_fs_symlink(loop, &req, "test_file_symlink", "test_file_symlink_symlink", 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
r = uv_fs_readlink(loop, &req, "test_file_symlink_symlink", NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(strcmp(req.ptr, "test_file_symlink") == 0);
uv_fs_req_cleanup(&req);
@@ -1127,23 +1128,23 @@ TEST_IMPL(fs_symlink) {
ASSERT(symlink_cb_count == 1);
r = uv_fs_open(loop, &req, "test_file_symlink2", O_RDWR, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
link = req.result;
uv_fs_req_cleanup(&req);
memset(buf, 0, sizeof(buf));
r = uv_fs_read(loop, &req, link, buf, sizeof(buf), 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
ASSERT(strcmp(buf, test_buf) == 0);
close(link);
r = uv_fs_symlink(loop, &req, "test_file_symlink2", "test_file_symlink2_symlink", 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
r = uv_fs_readlink(loop, &req, "test_file_symlink2_symlink", readlink_cb);
- ASSERT(r == 0);
+ ASSERT(r != -1);
uv_run(loop);
ASSERT(readlink_cb_count == 1);
@@ -1178,7 +1179,7 @@ TEST_IMPL(fs_utime) {
r = uv_fs_utime(loop, &req, path, atime, mtime, NULL);
ASSERT(r == 0);
- ASSERT(utime_req.result == 0);
+ ASSERT(req.result == 0);
uv_fs_req_cleanup(&req);
r = uv_fs_stat(loop, &req, path, NULL);
@@ -1217,7 +1218,7 @@ TEST_IMPL(fs_futime) {
atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
r = uv_fs_open(loop, &req, path, O_RDONLY, 0, NULL);
- ASSERT(r == 0);
+ ASSERT(r != -1);
ASSERT(req.result != -1);
file = req.result; /* FIXME probably not how it's supposed to be used */
uv_fs_req_cleanup(&req);
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index d510be299b..5f1100c9c0 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -196,7 +196,6 @@ TASK_LIST_START
TEST_ENTRY (fs_utime)
TEST_ENTRY (fs_futime)
TEST_ENTRY (fs_symlink)
- TEST_ENTRY (fs_symlink)
TEST_ENTRY (threadpool_queue_work_simple)