comparison mercurial/util.py @ 5740:9046a4f6a07c

atomictempfile: avoid chmod weirdness on Linux vfat
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Dec 2007 23:55:40 -0600
parents 45fa7b1c5d4c
children 2bd4d56ff37c
comparison
equal deleted inserted replaced
5739:45fa7b1c5d4c 5740:9046a4f6a07c
1311 os.close(fd) 1311 os.close(fd)
1312 # Temporary files are created with mode 0600, which is usually not 1312 # Temporary files are created with mode 0600, which is usually not
1313 # what we want. If the original file already exists, just copy 1313 # what we want. If the original file already exists, just copy
1314 # its mode. Otherwise, manually obey umask. 1314 # its mode. Otherwise, manually obey umask.
1315 try: 1315 try:
1316 st_mode = os.lstat(name).st_mode 1316 st_mode = os.lstat(name).st_mode & 0777
1317 except OSError, inst: 1317 except OSError, inst:
1318 if inst.errno != errno.ENOENT: 1318 if inst.errno != errno.ENOENT:
1319 raise 1319 raise
1320 st_mode = 0666 & ~_umask 1320 st_mode = 0666 & ~_umask
1321 os.chmod(temp, st_mode) 1321 os.chmod(temp, st_mode)