Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
submit error to correct loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 31, 2011
1 parent b47c474 commit ea4271f
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions src/unix/fs.c
Expand Up @@ -120,13 +120,13 @@ int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_close(file, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
} else {
/* sync */
if ((req->result = uv__close(file))) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -144,15 +144,15 @@ int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
uv_ref(loop);
req->eio = eio_open(path, flags, mode, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

} else {
/* sync */
req->result = open(path, flags, mode);
if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}

Expand All @@ -174,7 +174,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf,
uv__fs_after, req);

if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -185,7 +185,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf,
pread(fd, buf, length, offset);

if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -202,7 +202,7 @@ int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_unlink(path, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -211,7 +211,7 @@ int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
req->result = unlink(path);

if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -230,7 +230,7 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
req->eio = eio_write(file, buf, length, offset, EIO_PRI_DEFAULT,
uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -241,7 +241,7 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
pwrite(file, buf, length, offset);

if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -259,7 +259,7 @@ int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
uv_ref(loop);
req->eio = eio_mkdir(path, mode, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -268,7 +268,7 @@ int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
req->result = mkdir(path, mode);

if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -285,7 +285,7 @@ int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_rmdir(path, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -294,7 +294,7 @@ int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
req->result = rmdir(path);

if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -317,15 +317,15 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
uv_ref(loop);
req->eio = eio_readdir(path, flags, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

} else {
/* sync */
DIR* dir = opendir(path);
if (!dir) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}

Expand All @@ -342,7 +342,7 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,

r = closedir(dir);
if (r) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand Down Expand Up @@ -375,7 +375,7 @@ int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(pathdup);

if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -386,7 +386,7 @@ int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(pathdup);

if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}

Expand All @@ -412,7 +412,7 @@ int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* ne
uv_ref(loop);
req->eio = eio_rename(path, new_path, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -421,7 +421,7 @@ int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* ne
req->result = rename(path, new_path);

if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -438,7 +438,7 @@ int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_fsync(file, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -447,7 +447,7 @@ int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
req->result = fsync(file);

if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -464,7 +464,7 @@ int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_fdatasync(file, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -473,7 +473,7 @@ int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
req->result = fdatasync(file);

if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -491,7 +491,7 @@ int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file, off_t offset,
uv_ref(loop);
req->eio = eio_ftruncate(file, offset, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -500,7 +500,7 @@ int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file, off_t offset,
req->result = ftruncate(file, offset);

if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand All @@ -519,7 +519,7 @@ int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd,
req->eio = eio_sendfile(out_fd, in_fd, in_offset, length, EIO_PRI_DEFAULT,
uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -528,7 +528,7 @@ int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd,
req->result = eio_sendfile_sync(out_fd, in_fd, in_offset, length);

if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
Expand Down Expand Up @@ -582,7 +582,7 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(pathdup);

if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand All @@ -593,7 +593,7 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(pathdup);

if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}

Expand Down Expand Up @@ -680,7 +680,7 @@ int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
req->eio = eio_custom(uv__work, EIO_PRI_DEFAULT, uv__after_work, req);

if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}

Expand Down

0 comments on commit ea4271f

Please sign in to comment.