summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-08-10 16:04:17 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-08-10 16:04:17 +0200
commitb472c6b08e0bfd1ea94390cd525cef579ea3ccee (patch)
tree721bcf9bbe68590dc6409f4ba2bf85e2fac6a81f /apt-pkg/contrib
parent47f6d1b72bc883ecdc00542da4c824a5c4fb79fa (diff)
parent22041bd2864b8d0b401b45dde9eda4003a11fec4 (diff)
merge with debian-experimental-ma
* Swedish translation update. Closes: #592366 * apt-pkg/pkgcache.cc: - re-evaluate the architectures cache when the cache is (re)opened * apt-pkg/cdrom.cc: - fix off-by-one error in DropBinaryArch * apt-pkg/contrib/fileutl.cc: - Add WriteAtomic mode. - Revert WriteEmpty to old behavior (LP: #613211) * apt-pkg, methods: - Convert users of WriteEmpty to WriteAtomic. * 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). * debian/control: - Add dependency on gnupg to apt, apt-key uses it.
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/fileutl.cc11
-rw-r--r--apt-pkg/contrib/fileutl.h3
2 files changed, 12 insertions, 2 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 2a3b8a87d..91aecee65 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -669,7 +669,7 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
}
break;
- case WriteEmpty:
+ case WriteAtomic:
{
Flags |= Replace;
char *name = strdup((FileName + ".XXXXXX").c_str());
@@ -678,6 +678,15 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
free(name);
break;
}
+
+ case WriteEmpty:
+ {
+ struct stat Buf;
+ if (lstat(FileName.c_str(),&Buf) == 0 && S_ISLNK(Buf.st_mode))
+ unlink(FileName.c_str());
+ iFd = open(FileName.c_str(),O_RDWR | O_CREAT | O_TRUNC,Perms);
+ break;
+ }
case WriteExists:
iFd = open(FileName.c_str(),O_RDWR);
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 62705478d..cb4655798 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/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)
{