1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08:50 -05:00

pactest : safety check with MODE

check that the file exists first, otherwise pactest just breaks.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2009-07-17 19:33:13 +02:00 committed by Dan McGee
parent 8ebc07744a
commit a3ecbec6b5

View File

@ -116,9 +116,12 @@ class pmrule:
if not f.ismodified(): if not f.ismodified():
success = 0 success = 0
elif case == "MODE": elif case == "MODE":
mode = os.lstat(filename)[ST_MODE] if not os.path.isfile(filename):
if int(value,8) != S_IMODE(mode):
success = 0 success = 0
else:
mode = os.lstat(filename)[ST_MODE]
if int(value,8) != S_IMODE(mode):
success = 0
elif case == "TYPE": elif case == "TYPE":
if value == "dir": if value == "dir":
if not os.path.isdir(filename): if not os.path.isdir(filename):