Forráskód Böngészése

Fix the atomic replace.

Julian Andres Klode 16 éve
szülő
commit
fd3b761e8c
1 módosított fájl, 1 hozzáadás és 1 törlés
  1. 1 1
      apt-pkg/contrib/fileutl.cc

+ 1 - 1
apt-pkg/contrib/fileutl.cc

@@ -843,9 +843,9 @@ bool FileFd::Close()
    iFd = -1;
    iFd = -1;
 
 
    if ((Flags & Replace) == Replace) {
    if ((Flags & Replace) == Replace) {
-      FileName = TemporaryFileName; // for the unlink() below.
       if (rename(TemporaryFileName.c_str(), FileName.c_str()) != 0)
       if (rename(TemporaryFileName.c_str(), FileName.c_str()) != 0)
 	 Res &= _error->Errno("rename",_("Problem renaming the file"));
 	 Res &= _error->Errno("rename",_("Problem renaming the file"));
+      FileName = TemporaryFileName; // for the unlink() below.
    }
    }
 	    
 	    
    if ((Flags & Fail) == Fail && (Flags & DelOnFail) == DelOnFail &&
    if ((Flags & Fail) == Fail && (Flags & DelOnFail) == DelOnFail &&