if using sockets, reset the umask back to the old value after listening

v1.18.x
Julian Lam 10 years ago
parent 273e26ddb1
commit 68e761bed0

@ -101,11 +101,12 @@ if(nconf.get('ssl')) {
var isSocket = isNaN(port), var isSocket = isNaN(port),
args = isSocket ? [port] : [port, nconf.get('bind_address')], args = isSocket ? [port] : [port, nconf.get('bind_address')],
bind_address = ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')) + ':' + port; bind_address = ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')) + ':' + port,
oldUmask;
// Alter umask if necessary // Alter umask if necessary
if (isSocket) { if (isSocket) {
process.umask('0000'); oldUmask = process.umask('0000');
} }
args.push(function(err) { args.push(function(err) {
@ -115,6 +116,10 @@ if(nconf.get('ssl')) {
} }
winston.info('NodeBB is now listening on: ' + (isSocket ? port : bind_address)); winston.info('NodeBB is now listening on: ' + (isSocket ? port : bind_address));
if (oldUmask) {
process.umask(oldUmask);
}
callback(); callback();
}); });

Loading…
Cancel
Save