From 682e21dfe2cb62e91c7e7d920c763e99cbee3027 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Thu, 21 Jan 2016 17:35:10 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/4795 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: thefourtheye Reviewed-By: Roman Reiss --- lib/fs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 50d6afc8b41e08..af8001bb181698 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -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); } @@ -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); }