diff --git a/rlgwebd.js b/rlgwebd.js index 88532ba..e8bfaee 100755 --- a/rlgwebd.js +++ b/rlgwebd.js @@ -689,6 +689,8 @@ if (process.getuid() != 0) { process.exit(1); } +var httpServer; // declare here so shutdown() can find it + /* Open the control socket before chrooting where it can't be found */ var ctlServer = net.createServer(function (sock) { sock.on('data', conHandler); @@ -719,7 +721,7 @@ ctlServer.listen(ctlsocket, function () { tslog("Could not drop permissions: %s", err); process.exit(1); } - var httpServer = http.createServer(webHandler); + httpServer = http.createServer(webHandler); httpServer.listen(8080, "127.0.0.1"); tslog('rlgwebd running at http://127.0.0.1:8080/'); });