« Previous | Next » 

Revision c7da5329


Added by Stratos Psomadakis about 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.


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences