From 68e761bed08ece1a371adfc6982c8303be1ab85c Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 10 Dec 2014 18:16:09 -0500 Subject: [PATCH] if using sockets, reset the umask back to the old value after listening --- src/webserver.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/webserver.js b/src/webserver.js index fab94403ed..fd7cc5e473 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -101,11 +101,12 @@ if(nconf.get('ssl')) { var isSocket = isNaN(port), 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 if (isSocket) { - process.umask('0000'); + oldUmask = process.umask('0000'); } args.push(function(err) { @@ -115,6 +116,10 @@ if(nconf.get('ssl')) { } winston.info('NodeBB is now listening on: ' + (isSocket ? port : bind_address)); + if (oldUmask) { + process.umask(oldUmask); + } + callback(); });