From b16c26174fd625aba62ea5716e78b40d64812f3d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 10 Sep 2007 16:52:56 +0200 Subject: * apt-pkg/contrib/hashes.h: - fix anohter missing cstring include --- apt-pkg/contrib/hashes.h | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 93e7b25d9..264f7fe90 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -20,6 +20,7 @@ #include #include +#include using std::min; using std::vector; -- cgit v1.2.3 From faebb6992f9a4b8cfe95083c2ad63ff49b608ed0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 11 Sep 2007 20:50:31 +0200 Subject: * fix missing SetExecClose() call when the status-fd is used --- apt-pkg/packagemanager.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index 53600fb61..adcbec3d0 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -91,6 +91,8 @@ class pkgPackageManager : protected pkgCache::Namespace // stuff that needs to be done after the fork OrderResult DoInstallPostFork(int statusFd=-1) { + if(statusFd > 0) + SetCloseExec(statusFd, true); bool goResult = Go(statusFd); if(goResult == false) return Failed; -- cgit v1.2.3 From 1d6386f35066c1cc3c053f94fccf379d86075eac Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 14 Sep 2007 15:28:14 +0200 Subject: * apt-pkg/packagemanager.{cc,h}: - move DoInstallPostFork() out of the header into the .cc file --- apt-pkg/packagemanager.cc | 22 +++++++++++++++++++++- apt-pkg/packagemanager.h | 15 +-------------- 2 files changed, 22 insertions(+), 15 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 10e2858ed..d6172c6c4 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -25,7 +25,7 @@ #include #include - /*}}}*/ +#include using namespace std; @@ -624,6 +624,26 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() return Completed; } /*}}}*/ +// PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/ +// --------------------------------------------------------------------- +pkgPackageManager::OrderResult +pkgPackageManager::DoInstallPostFork(int statusFd) +{ + if(statusFd > 0) + // FIXME: use SetCloseExec here once it taught about throwing + // exceptions instead of doing _exit(100) on failure + fcntl(statusFd,F_SETFD,FD_CLOEXEC); + bool goResult = Go(statusFd); + if(goResult == false) + return Failed; + + // if all was fine update the state file + if(Res == Completed) { + Cache.writeStateFile(NULL); + } + return Res; +}; + // PM::DoInstall - Does the installation /*{{{*/ // --------------------------------------------------------------------- /* This uses the filenames in FileNames and the information in the diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index adcbec3d0..53cd4c96f 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -90,20 +90,7 @@ class pkgPackageManager : protected pkgCache::Namespace }; // stuff that needs to be done after the fork - OrderResult DoInstallPostFork(int statusFd=-1) { - if(statusFd > 0) - SetCloseExec(statusFd, true); - bool goResult = Go(statusFd); - if(goResult == false) - return Failed; - - // if all was fine update the state file - if(Res == Completed) { - Cache.writeStateFile(NULL); - } - return Res; - }; - + OrderResult DoInstallPostFork(int statusFd=-1); bool FixMissing(); pkgPackageManager(pkgDepCache *Cache); -- cgit v1.2.3 From f26fcbc707e106946e18682f917ebd6f96444302 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 18 Sep 2007 17:24:15 +0100 Subject: - fix parse error when dpkg sends unexpected data --- apt-pkg/deb/dpkgpm.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index ac63ccfdf..28b895ac7 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -392,14 +392,15 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) // statusfd or by rewriting the code here to deal with // it. for now we just ignore it and not crash TokSplitString(':', line, list, sizeof(list)/sizeof(list[0])); - char *pkg = list[1]; - char *action = _strstrip(list[2]); - if( pkg == NULL || action == NULL) + if( list[0] == NULL || list[1] == NULL || list[2] == NULL) { if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) std::clog << "ignoring line: not enough ':'" << std::endl; return; } + char *action = list[0]; + char *pkg = list[1]; + char *action = _strstrip(list[2]); if(strncmp(action,"error",strlen("error")) == 0) { -- cgit v1.2.3 From 314555a95560264aee5a9b1aa992a1f962ae6fea Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 18 Sep 2007 17:47:16 +0100 Subject: apt-pkg/deb/dpkgpm.cc: - make it compileable --- apt-pkg/deb/dpkgpm.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 28b895ac7..b92d0118c 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -398,7 +398,6 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) std::clog << "ignoring line: not enough ':'" << std::endl; return; } - char *action = list[0]; char *pkg = list[1]; char *action = _strstrip(list[2]); -- cgit v1.2.3 From e9fce64bd454e68641a265d384669217f2bc0558 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 27 Sep 2007 19:23:55 +0200 Subject: * apt-pkg/acquire-item.cc: - fix crash in diff acquire code * apt-pkg/contrib/mmap.cc: - don't fail if msync() returns > 0 --- apt-pkg/acquire-item.cc | 2 +- apt-pkg/contrib/mmap.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 32798335c..c38a50194 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -345,7 +345,7 @@ void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash, */ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, - HashString ExpectedMD5, + HashString ExpecteHash, vector diffs) : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), available_patches(diffs) diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 7f814c2d2..abcae46fe 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -117,7 +117,7 @@ bool MMap::Sync() #ifdef _POSIX_SYNCHRONIZED_IO if ((Flags & ReadOnly) != ReadOnly) - if (msync((char *)Base,iSize,MS_SYNC) != 0) + if (msync((char *)Base,iSize,MS_SYNC) < 0) return _error->Errno("msync","Unable to write mmap"); #endif return true; @@ -134,7 +134,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) #ifdef _POSIX_SYNCHRONIZED_IO unsigned long PSize = sysconf(_SC_PAGESIZE); if ((Flags & ReadOnly) != ReadOnly) - if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0) + if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0) return _error->Errno("msync","Unable to write mmap"); #endif return true; -- cgit v1.2.3 From 59d5cc74ef7c6ca820ed9d26a4d829b891214edf Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 27 Sep 2007 20:38:14 +0200 Subject: * apt-pkg/acquire-item.cc: - fix typo --- apt-pkg/acquire-item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index c38a50194..a6d01e3bb 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -345,7 +345,7 @@ void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash, */ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, - HashString ExpecteHash, + HashString ExpectedHash, vector diffs) : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), available_patches(diffs) -- cgit v1.2.3