Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix the returned Promise of fs.promises.symlink #18791

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
if (req_wrap != nullptr) { // symlink(target, path, flags, req)
AsyncDestCall(env, req_wrap, args, "symlink", *path, path.length(), UTF8,
AfterNoArgs, uv_fs_symlink, *target, *path, flags);
req_wrap->SetReturnValue(args);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not safe to call req_wrap->SetReturnValue(args) like this without checking if the pointer returned by AsyncDestCall is nullptr, see #18811 (that PR just calls SetReturnValue () inside AsyncDestCall so the binding do not have to touch req_wrap)

Copy link
Author

@shqld shqld Feb 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thank you for the information!

} else { // symlink(target, path, flags, undefinec, ctx)
CHECK_EQ(argc, 5);
fs_req_wrap req;
Expand Down