# HG changeset patch # User John "Elwin" Edwards # Date 1341794983 25200 # Node ID 4303d94d87a2ae546010d4b2e7ba244b432a3328 # Parent d59dc5cef4122a58443af489aaa0c719c93f045b rlgwebd.js: Unlink control socket at startup. Unlinking at shutdown doesn't work because at that time, the process is chroot'ed and unprivileged. diff -r d59dc5cef412 -r 4303d94d87a2 rlgwebd.js --- a/rlgwebd.js Sun Jul 08 08:40:08 2012 -0700 +++ b/rlgwebd.js Sun Jul 08 17:49:43 2012 -0700 @@ -992,7 +992,6 @@ httpServer.close(); httpServer.removeAllListeners('request'); ctlServer.close(); - fs.unlink(ctlsocket); tslog("Shutting down..."); process.exit(); } @@ -1027,6 +1026,11 @@ var httpServer; // declare here so shutdown() can find it +/* This could be nonblocking, but nothing else can start yet anyway. */ +if (fs.existsSync(ctlsocket)) { + fs.unlinkSync(ctlsocket); +} + /* Open the control socket before chrooting where it can't be found */ var ctlServer = net.createServer(function (sock) { sock.on('data', conHandler);