From 8a1241533f04b473cf70ee38fe94bca127f17a0b Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Sun, 7 Aug 2005 13:12:15 +0000 Subject: [PATCH] - Removed warning when using "-V" or "-h" with no config file. Thanks to Yaroslav Halchenko git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_5@182 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- fail2ban.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fail2ban.py b/fail2ban.py index c7702790..131914a5 100755 --- a/fail2ban.py +++ b/fail2ban.py @@ -114,10 +114,6 @@ def getCmdLineOptions(optList): """ Gets the command line options """ for opt in optList: - if opt[0] in ["-h", "--help"]: - dispUsage() - if opt[0] in ["-V", "--version"]: - dispVersion() if opt[0] == "-v": conf["verbose"] = conf["verbose"] + 1 if opt[0] == "-b": @@ -166,6 +162,10 @@ def main(): for opt in optList: if opt[0] == "-c": conf["conffile"] = opt[1] + if opt[0] in ["-h", "--help"]: + dispUsage() + if opt[0] in ["-V", "--version"]: + dispVersion() # Reads the config file and create a LogReader instance for # each log file to check. @@ -276,7 +276,10 @@ def main(): logSys.error("Fail2Ban already running with PID "+pid) sys.exit(-1) else: - pidLock.create() + ret = pidLock.create() + if not ret: + # Unable to create PID lock. Exit + sys.exit(-1) logSys.debug("ConfFile is " + conf["conffile"]) logSys.debug("BanTime is " + `conf["bantime"]`)