From 92e2046b81e9d0d93526baa7b8c61b9ba25fbb94 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 27 Apr 2009 10:39:22 -0500 Subject: [PATCH] Added additional check for pidfile writability to supybot-botchk. --- scripts/supybot-botchk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index bd9730fdf..d8a8801c7 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -111,6 +111,13 @@ if __name__ == '__main__': debug('Pid %s is not the bot.' % pid) if not foundBot: + # First, we check if the pidfile is writable. If not, supybot will just exit, + # so we go ahead and refuse to start it. + try: + file(options.pidfile, 'r+') + except EnvironmentError, e: + fatal('pidfile (%s) is not writable: %s', options.pidfile, e) + sys.exit(-1) debug('Bot not found, starting.') home = os.environ['HOME'] inst = popen2.Popen4('sh')