Skip to content
Permalink
Browse files

fs: remove unused branches

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 21, 2016
1 parent 386ad7e commit fa940cf9bc59cedae3ee70bfc927e0ad111fb434
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/fs.js
@@ -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);
}
@@ -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);
}

0 comments on commit fa940cf

Please sign in to comment.
You can’t perform that action at this time.