Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Upgrade libuv to 4197fc7
Browse files Browse the repository at this point in the history
and use return value from sync uv_fs functions
  • Loading branch information
ry committed Sep 14, 2011
1 parent 7096600 commit a6ef3eb
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 84 deletions.
12 changes: 1 addition & 11 deletions deps/uv/src/unix/eio/eio.c
Expand Up @@ -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;
Expand Down
20 changes: 16 additions & 4 deletions deps/uv/src/unix/fs.c
Expand Up @@ -55,8 +55,8 @@
req->result = func(args); \
if (req->result) { \
uv_err_new(loop, errno); \
return -1; \
} \
return req->result; \
} \
return 0;

Expand Down Expand Up @@ -116,15 +116,16 @@ 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.
* This is done because libeio is going to free eio->ptr2 after this
* 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++) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit a6ef3eb

Please sign in to comment.