summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-02-14 14:07:17 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-02-14 14:07:17 +0100
commit8d009e3e8ac6c6431a8bc79a07d9ad7c0295d160 (patch)
tree361496f3f028a8c876c1059fd547b0191237ce67 /apt-pkg
parent5645e8b1cebb57134df717b8339248811cb762f2 (diff)
parent94244f75f8280c9b4018736d503d17455c284b2d (diff)
merged from debian-sid
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/fileutl.cc13
-rw-r--r--apt-pkg/contrib/mmap.cc2
-rw-r--r--apt-pkg/contrib/mmap.h1
-rw-r--r--apt-pkg/depcache.cc5
4 files changed, 17 insertions, 4 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 52f517ee0..24e3f08d9 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -42,6 +42,10 @@
#include <errno.h>
#include <set>
#include <algorithm>
+
+#ifndef WORDS_BIGENDIAN
+#include <inttypes.h>
+#endif
/*}}}*/
using namespace std;
@@ -962,9 +966,16 @@ unsigned long FileFd::Size()
off_t orig_pos = lseek(iFd, 0, SEEK_CUR);
if (lseek(iFd, -4, SEEK_END) < 0)
return _error->Errno("lseek","Unable to seek to end of gzipped file");
+ size = 0L;
if (read(iFd, &size, 4) != 4)
return _error->Errno("read","Unable to read original size of gzipped file");
- size &= 0xFFFFFFFF;
+
+#ifdef WORDS_BIGENDIAN
+ uint32_t tmp_size = size;
+ uint8_t const * const p = (uint8_t const * const) &tmp_size;
+ tmp_size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
+ size = tmp_size;
+#endif
if (lseek(iFd, orig_pos, SEEK_SET) < 0)
return _error->Errno("lseek","Unable to seek in gzipped file");
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 69fb61fca..4978446d2 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -266,6 +266,8 @@ DynamicMMap::~DynamicMMap()
{
if (Fd == 0)
{
+ if (Base == 0)
+ return;
#ifdef _POSIX_MAPPED_FILES
munmap(Base, WorkSpace);
#else
diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h
index 5ca951204..e9baa9339 100644
--- a/apt-pkg/contrib/mmap.h
+++ b/apt-pkg/contrib/mmap.h
@@ -61,6 +61,7 @@ class MMap
inline operator void *() {return Base;};
inline void *Data() {return Base;};
inline unsigned long Size() {return iSize;};
+ inline void AddSize(unsigned long const size) {iSize += size;};
// File manipulators
bool Sync();
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 4c12a4fe1..a8bf4d3ae 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1261,9 +1261,8 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
if(FromUser)
{
- // Set it to manual if it's a new install or cancelling the
- // removal of a garbage package.
- if(P.Status == 2 || (!Pkg.CurrentVer().end() && !P.Marked))
+ // Set it to manual if it's a new install or already installed
+ if(P.Status == 2 || Pkg->CurrentVer != 0)
P.Flags &= ~Flag::Auto;
}
else