« Previous | Next » 

Revision c7da5329

IDc7da5329a9d6788a579346c0ec014883b04a0af4

Added by Stratos Psomadakis over 10 years ago

Create tempfile in the same dir as passwdfile

write_wrapper() uses a tempfile to write the new contents of the
passwdfile and then atomically renames / moves it to the original passwd
file. os.rename() won't work if the tempfile is not created on the same
partition as the original file (EXDEV error). We must, thus, create the
tempfile on the same directory as the original file, to ensure that
os.rename() will work.

shutil.move() cannot replace os.rename(), because it's not atomic wrt
the contents of the original file.

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences