Преглед изворни кода

apt-pkg/contrib/fileutl.cc: Add WriteAtomic mode.

Julian Andres Klode пре 16 година
родитељ
комит
4a9db82795
3 измењених фајлова са 6 додато и 1 уклоњено
  1. 2 0
      apt-pkg/contrib/fileutl.cc
  2. 2 1
      apt-pkg/contrib/fileutl.h
  3. 2 0
      debian/changelog

+ 2 - 0
apt-pkg/contrib/fileutl.cc

@@ -669,6 +669,7 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
       }
       break;
       
+      case WriteAtomic:
       case WriteEmpty:
       {
 	 Flags |= Replace;
@@ -678,6 +679,7 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
 	 free(name);
 	 break;
       }
+
       
       case WriteExists:
       iFd = open(FileName.c_str(),O_RDWR);

+ 2 - 1
apt-pkg/contrib/fileutl.h

@@ -46,7 +46,8 @@ class FileFd
    gzFile gz;
 
    public:
-   enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip};
+   enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip,
+                  WriteAtomic};
    
    inline bool Read(void *To,unsigned long Size,bool AllowEof)
    {

+ 2 - 0
debian/changelog

@@ -9,6 +9,8 @@ apt (0.7.26~exp13) UNRELEASEDexperimental; urgency=low
     - fix off-by-one error in DropBinaryArch
 
   [ Julian Andres Klode ]
+  * apt-pkg/contrib/fileutl.cc:
+    - Add WriteAtomic mode.
   * apt-pkg/depcache.cc:
     - Only try upgrade for Breaks if there is a newer version, otherwise
       handle it as Conflicts (by removing it) (helps for #591882).