From f84a03d6b57b9a82fc42cd8e98dd71c11ddceeb8 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 12 Dec 2013 09:08:42 +0000 Subject: [PATCH] BF: remove nonreachable parts of code Glob ensures the file exists so only a check that a missing dangling symlink needs to be done. $ ls -la /tmp/f2b-tempq0ipGY/f2 lrwxrwxrwx. 1 dan dan 11 Dec 12 08:42 /tmp/f2b-tempq0ipGY/f2 -> xisting In [3]: os.path.exists('/tmp/f2b-tempq0ipGY/f2') Out[3]: False In [4]: os.path.lexists('/tmp/f2b-tempq0ipGY/f2') Out[4]: True --- client/jailreader.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/client/jailreader.py b/client/jailreader.py index 8980431e..1c651fe9 100644 --- a/client/jailreader.py +++ b/client/jailreader.py @@ -64,13 +64,10 @@ class JailReader(ConfigReader): """ pathList = [] for p in glob.glob(path): - if not os.path.exists(p): - if os.path.lexists(p): - logSys.warning("File %s is a dangling link, thus cannot be monitored" % p) - else: - logSys.warning("File %s doesn't even exist, thus cannot be monitored" % p) - else: + if os.path.exists(p): pathList.append(p) + else: + logSys.warning("File %s is a dangling link, thus cannot be monitored" % p) return pathList def getOptions(self):