Skip to content

Commit

Permalink
fs: remove unused branches
Browse files Browse the repository at this point in the history
In a few places the code was refactored to use `maybeCallback` which
always returns a function. Checking for `if (callback)` always returns
true anyway.

PR-URL: nodejs#4795
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: thefourtheye <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
  • Loading branch information
benjamingr authored and Michael Scovetta committed Apr 2, 2016
1 parent 40646cf commit 682e21d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,16 +1160,16 @@ function writeAll(fd, isUserFd, buffer, offset, length, position, callback_) {
fs.write(fd, buffer, offset, length, position, function(writeErr, written) {
if (writeErr) {
if (isUserFd) {
if (callback) callback(writeErr);
callback(writeErr);
} else {
fs.close(fd, function() {
if (callback) callback(writeErr);
callback(writeErr);
});
}
} else {
if (written === length) {
if (isUserFd) {
if (callback) callback(null);
callback(null);
} else {
fs.close(fd, callback);
}
Expand Down Expand Up @@ -1207,7 +1207,7 @@ fs.writeFile = function(path, data, options, callback_) {

fs.open(path, flag, options.mode, function(openErr, fd) {
if (openErr) {
if (callback) callback(openErr);
callback(openErr);
} else {
writeFd(fd, false);
}
Expand Down

0 comments on commit 682e21d

Please sign in to comment.