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: #4795
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
benjamingr authored and rvagg committed Jan 25, 2016
1 parent 386ad7e commit fa940cf
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 @@ -1146,16 +1146,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 @@ -1193,7 +1193,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 fa940cf

Please sign in to comment.