Skip to content

Instantly share code, notes, and snippets.

@igorzi
Created September 14, 2011 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorzi/1217225 to your computer and use it in GitHub Desktop.
Save igorzi/1217225 to your computer and use it in GitHub Desktop.
From 65c8a727a3bad4063adb2a462ce9e830acdcbd6d Mon Sep 17 00:00:00 2001
From: Igor Zinkovsky <igorzi@microsoft.com>
Date: Wed, 14 Sep 2011 10:43:45 -0700
Subject: [PATCH] uv_fs_ functions to return result in sync mode
---
src/unix/fs.c | 15 ++++++++-
src/win/fs.c | 25 ++++++++++++++++
test/test-fs.c | 89 ++++++++++++++++++++++++++++---------------------------
3 files changed, 83 insertions(+), 46 deletions(-)
diff --git a/src/unix/fs.c b/src/unix/fs.c
index 554ef90..9f15db8 100644
--- a/src/unix/fs.c
+++ b/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;
@@ -204,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;
@@ -235,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;
@@ -270,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;
@@ -342,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;
@@ -388,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;
@@ -417,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;
@@ -547,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;
@@ -612,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/src/win/fs.c b/src/win/fs.c
index b195205..d013b58 100644
--- a/src/win/fs.c
+++ b/src/win/fs.c
@@ -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/test/test-fs.c b/test/test-fs.c
index 99415c6..0c115c1 100644
--- a/test/test-fs.c
+++ b/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);
--
1.7.4.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment