equal
deleted
inserted
replaced
669 # a FS remount. Frequently we can detect it if files are created |
669 # a FS remount. Frequently we can detect it if files are created |
670 # with exec bit on. |
670 # with exec bit on. |
671 |
671 |
672 try: |
672 try: |
673 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
673 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
674 fh, fn = tempfile.mkstemp("", "", path) |
674 fh, fn = tempfile.mkstemp(dir=path, prefix='hg-checkexec-') |
675 try: |
675 try: |
676 os.close(fh) |
676 os.close(fh) |
677 m = os.stat(fn).st_mode & 0777 |
677 m = os.stat(fn).st_mode & 0777 |
678 new_file_has_exec = m & EXECFLAGS |
678 new_file_has_exec = m & EXECFLAGS |
679 os.chmod(fn, m ^ EXECFLAGS) |
679 os.chmod(fn, m ^ EXECFLAGS) |