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

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

wants to merge 1 commit into from

Conversation

shqld
Copy link

@shqld shqld commented Feb 15, 2018

Overview

Cf. #18674
I added missing req_wrap->SetReturnValue(args); in Symlink of node_file.cc.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

src, fs

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. labels Feb 15, 2018
Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

Is there a test that can be added for this?

@benjamingr
Copy link
Member

benjamingr commented Feb 15, 2018

Note that this conflicts with #18777

Also +1 on adding a test

@shqld
Copy link
Author

shqld commented Feb 15, 2018

Do you mean a test for node_file.cc? just the returned Promise of each fs.promises function?

@@ -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!

@shqld shqld closed this Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants