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

backport close race condition fix from 1.3 #4

Closed
wants to merge 1 commit into from
Closed

Conversation

andrasq
Copy link
Owner

@andrasq andrasq commented Nov 5, 2015

this got fixed during the refactor without it being caught as the source of a race condition.
This is a minimal patch to the 1.2 branch; qfputs-1.3 and 1.4 do not have this issue.

@andrasq andrasq closed this Nov 5, 2015
@andrasq andrasq deleted the review3 branch November 5, 2015 15:46
@@ -139,13 +139,13 @@ FileWriter.prototype = {
function finish(err) {
if (guard && global.clearTimeout) clearTimeout(guard);
guard = null;
if (fd !== null) fs.close(fd, function(){});
if (fd !== null) try { fs.closeSync(fd) } catch (e) { }

Choose a reason for hiding this comment

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

Wouldn't we want to do anything if this failed?

Copy link
Owner Author

Choose a reason for hiding this comment

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

it doesn't affect correct operation, but we can return the error at least, sure, to let the caller know
that there was a problem. A close error could in theory leak a file descriptor (the possible errors from
the close system call are EBADF, EINTR and EIO)

Copy link
Owner Author

Choose a reason for hiding this comment

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

the change I pushed showed up in PR #5 ? see https://github.com/andrasq/node-qfputs/pull/5/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants