Skip to content

Commit

Permalink
fs: Remove unused branches
Browse files Browse the repository at this point in the history
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: #5289
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
  • Loading branch information
benjamingr authored and Myles Borins committed Apr 8, 2016
1 parent feedca7 commit 56dda6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ function writeAll(fd, buffer, offset, length, position, callback_) {
fs.write(fd, buffer, offset, length, position, function(writeErr, written) {
if (writeErr) {
fs.close(fd, function() {
if (callback) callback(writeErr);
callback(writeErr);
});
} else {
if (written === length) {
Expand Down Expand Up @@ -1131,7 +1131,7 @@ fs.writeFile = function(path, data, options, callback_) {
var flag = options.flag || 'w';
fs.open(path, flag, options.mode, function(openErr, fd) {
if (openErr) {
if (callback) callback(openErr);
callback(openErr);
} else {
var buffer = (data instanceof Buffer) ? data : new Buffer('' + data,
options.encoding || 'utf8');
Expand Down

0 comments on commit 56dda6f

Please sign in to comment.