From a3ecbec6b584b3595c041850e4c8bf242f7ce74a Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Fri, 17 Jul 2009 19:33:13 +0200 Subject: pactest : safety check with MODE check that the file exists first, otherwise pactest just breaks. Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- pactest/pmrule.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pactest') diff --git a/pactest/pmrule.py b/pactest/pmrule.py index ea3ad333..e7c9c44f 100755 --- a/pactest/pmrule.py +++ b/pactest/pmrule.py @@ -116,9 +116,12 @@ class pmrule: if not f.ismodified(): success = 0 elif case == "MODE": - mode = os.lstat(filename)[ST_MODE] - if int(value,8) != S_IMODE(mode): + if not os.path.isfile(filename): success = 0 + else: + mode = os.lstat(filename)[ST_MODE] + if int(value,8) != S_IMODE(mode): + success = 0 elif case == "TYPE": if value == "dir": if not os.path.isdir(filename): -- cgit v1.2.3-70-g09d2