lib: simplify 'umask'

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 <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>
This commit is contained in:
MaleDong
2019-02-10 21:06:54 +08:00
committed by Daniel Bevenius
parent 048b977d8e
commit ec76f7cf8f

View File

@@ -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);
}