From 92476622f7cdd415eecc16f8af44d9126e369e0c Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Sat, 11 Aug 2007 16:26:24 -0700 Subject: [PATCH] Fail if gitosis-serve can't read the config file. --- gitosis/serve.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gitosis/serve.py b/gitosis/serve.py index b0f4b9c..496f942 100644 --- a/gitosis/serve.py +++ b/gitosis/serve.py @@ -66,7 +66,15 @@ def main(): die("Command to run looks dangerous") cfg = RawConfigParser() - cfg.read(options.config) + try: + conffile = file(options.config) + except (IOError, OSError), e: + # I trust the exception has the path. + die("Unable to read config file: %s." % e) + try: + cfg.readfp(conffile) + finally: + conffile.close() os.chdir(os.path.expanduser('~'))