Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,7 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
bool use_bigint = args[1]->IsTrue();
if (!args[2]->IsUndefined()) { // lstat(path, use_bigint, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2, use_bigint);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN1(
UV_FS_LSTAT, req_wrap_async, "path", TRACE_STR_COPY(*path))
AsyncCall(env, req_wrap_async, args, "lstat", UTF8, AfterStat,
Expand Down Expand Up @@ -1185,6 +1186,7 @@ static void FStat(const FunctionCallbackInfo<Value>& args) {
bool use_bigint = args[1]->IsTrue();
if (!args[2]->IsUndefined()) { // fstat(fd, use_bigint, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2, use_bigint);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN0(UV_FS_FSTAT, req_wrap_async)
AsyncCall(env, req_wrap_async, args, "fstat", UTF8, AfterStat,
uv_fs_fstat, fd);
Expand Down Expand Up @@ -1286,6 +1288,7 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // symlink(target, path, flags, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN2(UV_FS_SYMLINK,
req_wrap_async,
"target",
Expand Down Expand Up @@ -1324,6 +1327,7 @@ static void Link(const FunctionCallbackInfo<Value>& args) {

if (argc > 2) { // link(src, dest, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
CHECK_NOT_NULL(req_wrap_async);
// To avoid bypass the link target should be allowed to read and write
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
env,
Expand Down Expand Up @@ -1382,6 +1386,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {

if (argc > 2) { // readlink(path, encoding, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN1(
UV_FS_READLINK, req_wrap_async, "path", TRACE_STR_COPY(*path))
AsyncCall(env, req_wrap_async, args, "readlink", encoding, AfterStringPtr,
Expand Down Expand Up @@ -1422,6 +1427,7 @@ static void Rename(const FunctionCallbackInfo<Value>& args) {

if (argc > 2) { // rename(old_path, new_path, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
CHECK_NOT_NULL(req_wrap_async);
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
env,
req_wrap_async,
Expand Down Expand Up @@ -1479,6 +1485,7 @@ static void FTruncate(const FunctionCallbackInfo<Value>& args) {

if (argc > 2) { // ftruncate(fd, len, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN0(UV_FS_FTRUNCATE, req_wrap_async)
AsyncCall(env, req_wrap_async, args, "ftruncate", UTF8, AfterNoArgs,
uv_fs_ftruncate, fd, len);
Expand Down Expand Up @@ -1588,6 +1595,7 @@ static void RMDir(const FunctionCallbackInfo<Value>& args) {

if (argc > 1) {
FSReqBase* req_wrap_async = GetReqWrap(args, 1); // rmdir(path, req)
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN1(
UV_FS_RMDIR, req_wrap_async, "path", TRACE_STR_COPY(*path))
AsyncCall(env, req_wrap_async, args, "rmdir", UTF8, AfterNoArgs,
Expand Down Expand Up @@ -1885,6 +1893,7 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // mkdir(path, mode, recursive, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN1(
UV_FS_UNLINK, req_wrap_async, "path", TRACE_STR_COPY(*path))
AsyncCall(env, req_wrap_async, args, "mkdir", UTF8,
Expand Down Expand Up @@ -1931,6 +1940,7 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {

if (argc > 2) { // realpath(path, encoding, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN1(
UV_FS_REALPATH, req_wrap_async, "path", TRACE_STR_COPY(*path))
AsyncCall(env, req_wrap_async, args, "realpath", encoding, AfterStringPtr,
Expand Down Expand Up @@ -1992,6 +2002,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // readdir(path, encoding, withTypes, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
env,
req_wrap_async,
Expand Down Expand Up @@ -2239,6 +2250,7 @@ static void CopyFile(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // copyFile(src, dest, flags, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
env,
req_wrap_async,
Expand Down Expand Up @@ -2374,6 +2386,7 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // writeBuffers(fd, chunks, pos, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN0(UV_FS_WRITE, req_wrap_async)
AsyncCall(env,
req_wrap_async,
Expand Down Expand Up @@ -2758,6 +2771,7 @@ static void ReadBuffers(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // readBuffers(fd, buffers, pos, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN0(UV_FS_READ, req_wrap_async)
AsyncCall(env, req_wrap_async, args, "read", UTF8, AfterInteger,
uv_fs_read, fd, *iovs, iovs.length(), pos);
Expand Down Expand Up @@ -2795,6 +2809,7 @@ static void Chmod(const FunctionCallbackInfo<Value>& args) {

if (argc > 2) { // chmod(path, mode, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN1(
UV_FS_CHMOD, req_wrap_async, "path", TRACE_STR_COPY(*path))
AsyncCall(env, req_wrap_async, args, "chmod", UTF8, AfterNoArgs,
Expand Down Expand Up @@ -2827,6 +2842,7 @@ static void FChmod(const FunctionCallbackInfo<Value>& args) {

if (argc > 2) { // fchmod(fd, mode, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHMOD, req_wrap_async)
AsyncCall(env, req_wrap_async, args, "fchmod", UTF8, AfterNoArgs,
uv_fs_fchmod, fd, mode);
Expand Down Expand Up @@ -2904,6 +2920,7 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // fchown(fd, uid, gid, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHOWN, req_wrap_async)
AsyncCall(env, req_wrap_async, args, "fchown", UTF8, AfterNoArgs,
uv_fs_fchown, fd, uid, gid);
Expand Down Expand Up @@ -2934,6 +2951,7 @@ static void LChown(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // lchown(path, uid, gid, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
env,
req_wrap_async,
Expand Down Expand Up @@ -2976,6 +2994,7 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // utimes(path, atime, mtime, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN1(
UV_FS_UTIME, req_wrap_async, "path", TRACE_STR_COPY(*path))
AsyncCall(env, req_wrap_async, args, "utime", UTF8, AfterNoArgs,
Expand Down Expand Up @@ -3008,6 +3027,7 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // futimes(fd, atime, mtime, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN0(UV_FS_FUTIME, req_wrap_async)
AsyncCall(env, req_wrap_async, args, "futime", UTF8, AfterNoArgs,
uv_fs_futime, fd, atime, mtime);
Expand Down Expand Up @@ -3040,6 +3060,7 @@ static void LUTimes(const FunctionCallbackInfo<Value>& args) {

if (argc > 3) { // lutimes(path, atime, mtime, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
CHECK_NOT_NULL(req_wrap_async);
FS_ASYNC_TRACE_BEGIN1(
UV_FS_LUTIME, req_wrap_async, "path", TRACE_STR_COPY(*path))
AsyncCall(env, req_wrap_async, args, "lutime", UTF8, AfterNoArgs,
Expand Down Expand Up @@ -3072,6 +3093,7 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {

if (argc > 2) { // mkdtemp(tmpl, encoding, req)
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
CHECK_NOT_NULL(req_wrap_async);
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
env,
req_wrap_async,
Expand Down
Loading