From ec76f7cf8f4becb2c388aa6ad771f134f1466147 Mon Sep 17 00:00:00 2001 From: MaleDong Date: Sun, 10 Feb 2019 21:06:54 +0800 Subject: [PATCH] lib: simplify 'umask' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just check: if 'mask' is not undefined, just call 'validateMode' and then return the unmask value, we don't need split them into two returns. PR-URL: https://github.com/nodejs/node/pull/26035 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: Jeremiah Senkpiel Reviewed-By: Michaƫl Zasso Reviewed-By: Sakthipriyan Vairamani Reviewed-By: James M Snell --- lib/internal/process/main_thread_only.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/internal/process/main_thread_only.js b/lib/internal/process/main_thread_only.js index 96c57fda35c755..2572402f620c27 100644 --- a/lib/internal/process/main_thread_only.js +++ b/lib/internal/process/main_thread_only.js @@ -26,11 +26,9 @@ function wrapProcessMethods(binding) { } function umask(mask) { - if (mask === undefined) { - // Get the mask - return binding.umask(mask); + if (mask !== undefined) { + mask = validateMode(mask, 'mask'); } - mask = validateMode(mask, 'mask'); return binding.umask(mask); }