From 319790f4f86f595724fb2bd5aa6274d345469010 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 20 Mar 2012 19:23:32 +0100 Subject: * methods/rred.cc: - check return of writev() as gcc recommends * methods/mirror.cc: - check return of chdir() as gcc recommends * apt-pkg/deb/dpkgpm.cc: - check return of write() a gcc recommends * apt-inst/deb/debfile.cc: - check return of chdir() as gcc recommends * apt-inst/deb/dpkgdb.cc: - check return of chdir() as gcc recommends --- apt-inst/deb/debfile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-inst/deb/debfile.cc') diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc index 4bd065cf8..aeab82e82 100644 --- a/apt-inst/deb/debfile.cc +++ b/apt-inst/deb/debfile.cc @@ -121,7 +121,7 @@ bool debDebFile::ExtractControl(pkgDataBase &DB) // Switch out of the tmp directory. if (chdir(Cwd.c_str()) != 0) - chdir("/"); + return _error->Errno("chdir",_("Unable to change to %s"),Cwd.c_str()); return true; } -- cgit v1.2.3 From 9c257550854273ff6defb1816cb210d51f64db03 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 22 Mar 2012 13:09:22 +0100 Subject: =?UTF-8?q?*=20apt-inst/database.{cc,h},=20apt-inst/deb/dpkgdb.{cc?= =?UTF-8?q?,h}:=20=20=20-=20drop=20instead=20of=20fix=20as=20it=20is=20onl?= =?UTF-8?q?y=20needed=20if=20you=20want=20to=20reimplement=20dpkg=20=20=20?= =?UTF-8?q?=20=20and=20comes=20straight=20from=20the=20beginning=20of=20la?= =?UTF-8?q?st=20decade=20(Closes:=20#663372)=20*=20apt-inst/deb/debfile.cc?= =?UTF-8?q?:=20=20=20-=20{Extract,Merge}Control()=20is=20another=20instanc?= =?UTF-8?q?e=20of=20"lets=20reimplement=20dpkg"=20=20=20=20=20so=20shot=20?= =?UTF-8?q?of=20this=20code=20before=20someone=20ends=20up=20using=20this?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apt-inst/deb/debfile.cc | 63 ------------------------------------------------- 1 file changed, 63 deletions(-) (limited to 'apt-inst/deb/debfile.cc') diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc index aeab82e82..ab4037915 100644 --- a/apt-inst/deb/debfile.cc +++ b/apt-inst/deb/debfile.cc @@ -18,7 +18,6 @@ // Include Files /*{{{*/ #include -#include #include #include #include @@ -90,42 +89,6 @@ const ARArchive::Member *debDebFile::GotoMember(const char *Name) return Member; } /*}}}*/ -// DebFile::ExtractControl - Extract Control information /*{{{*/ -// --------------------------------------------------------------------- -/* Extract the control information into the Database's temporary - directory. */ -bool debDebFile::ExtractControl(pkgDataBase &DB) -{ - // Get the archive member and positition the file - const ARArchive::Member *Member = GotoMember("control.tar.gz"); - if (Member == 0) - return false; - - // Prepare Tar - ControlExtract Extract; - ExtractTar Tar(File,Member->Size,"gzip"); - if (_error->PendingError() == true) - return false; - - // Get into the temporary directory - std::string Cwd = SafeGetCWD(); - std::string Tmp; - if (DB.GetMetaTmp(Tmp) == false) - return false; - if (chdir(Tmp.c_str()) != 0) - return _error->Errno("chdir",_("Couldn't change to %s"),Tmp.c_str()); - - // Do extraction - if (Tar.Go(Extract) == false) - return false; - - // Switch out of the tmp directory. - if (chdir(Cwd.c_str()) != 0) - return _error->Errno("chdir",_("Unable to change to %s"),Cwd.c_str()); - - return true; -} - /*}}}*/ // DebFile::ExtractArchive - Extract the archive data itself /*{{{*/ // --------------------------------------------------------------------- /* Simple wrapper around tar.. */ @@ -167,32 +130,6 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream) return Tar.Go(Stream); } /*}}}*/ -// DebFile::MergeControl - Merge the control information /*{{{*/ -// --------------------------------------------------------------------- -/* This reads the extracted control file into the cache and returns the - version that was parsed. All this really does is select the correct - parser and correct file to parse. */ -pkgCache::VerIterator debDebFile::MergeControl(pkgDataBase &DB) -{ - // Open the control file - std::string Tmp; - if (DB.GetMetaTmp(Tmp) == false) - return pkgCache::VerIterator(DB.GetCache()); - FileFd Fd(Tmp + "control",FileFd::ReadOnly); - if (_error->PendingError() == true) - return pkgCache::VerIterator(DB.GetCache()); - - // Parse it - debListParser Parse(&Fd); - pkgCache::VerIterator Ver(DB.GetCache()); - if (DB.GetGenerator().MergeList(Parse,&Ver) == false) - return pkgCache::VerIterator(DB.GetCache()); - - if (Ver.end() == true) - _error->Error(_("Failed to locate a valid control file")); - return Ver; -} - /*}}}*/ // DebFile::ControlExtract::DoItem - Control Tar Extraction /*{{{*/ // --------------------------------------------------------------------- -- cgit v1.2.3