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 authored and Daniel Bevenius committed 2019-02-13 13:45:38 +01:00
1 parent 048b977d8e
commit ec76f7cf8f
1 file changed
+2 -4
+2 -4
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);
}