File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -647,16 +647,19 @@ def check_file_ownership(file_path, owner_name):
647
647
file_stat = os .stat (file_path )
648
648
return (file_stat .st_uid == owner_uid .pw_uid and
649
649
stat .S_ISREG (file_stat .st_mode ))
650
- except OSError : # file does not exist
650
+ except OSError : # file does not exist
651
651
return False
652
652
653
653
def check_file_and_perms (file_path , owner_name , permissions ):
654
654
"""Return True if the file at 'file_path' exists, is owned by
655
655
'owner_name', is a file, and has the given permissions; False otherwise
656
656
"""
657
- file_stat = os .stat (file_path )
658
- return (check_file_ownership (file_path , owner_name ) and
659
- file_stat .st_mode & 0o7777 == permissions )
657
+ try :
658
+ file_stat = os .stat (file_path )
659
+ return (check_file_ownership (file_path , owner_name ) and
660
+ file_stat .st_mode & 0o7777 == permissions )
661
+ except OSError : # file does not exist
662
+ return False
660
663
661
664
def parse_env_output (output ):
662
665
"""
You can’t perform that action at this time.
0 commit comments