Skip to content

Commit

Permalink
lib: simplify 'umask'
Browse files Browse the repository at this point in the history
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: #26035
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
MaleDong authored and addaleax committed Feb 13, 2019
1 parent b1a8927 commit b2b37c6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/internal/process/main_thread_only.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit b2b37c6

Please sign in to comment.