X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/8bd823d0a1f7e08ad94a7110bb118f73348133a1..53f3fc59f4eb37eea57bbde53fb75f2e15af0378:/apt-pkg/sourcelist.cc?ds=sidebyside diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index f4a84cc9b..df2e0b46d 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -423,18 +423,18 @@ bool pkgSourceList::ParseFileOldStyle(std::string const &File) /* Returns: the number of stanzas parsed*/ bool pkgSourceList::ParseFileDeb822(string const &File) { - unsigned int i = 1; - // see if we can read the file FileFd Fd(File, FileFd::ReadOnly); pkgTagFile Sources(&Fd, pkgTagFile::SUPPORT_COMMENTS); if (Fd.IsOpen() == false || Fd.Failed()) - return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str()); + return _error->Error(_("Malformed stanza %u in source list %s (type)"),0,File.c_str()); // read step by step pkgTagSection Tags; + unsigned int i = 0; while (Sources.Step(Tags) == true) { + ++i; if(Tags.Exists("Types") == false) return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str()); @@ -452,8 +452,6 @@ bool pkgSourceList::ParseFileDeb822(string const &File) if (!Parse->ParseStanza(SrcList, Tags, i, Fd)) return false; - - ++i; } } return true; @@ -570,7 +568,8 @@ bool pkgSourceList::AddVolatileFile(std::string const &File, std::vector * const VolatileCmdL)/*{{{*/ { std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const * const I) { - if (I != nullptr && (I[0] == '/' || (I[0] == '.' && ((I[1] == '.' && I[2] == '/') || I[1] == '/')))) + if (I != nullptr && (I[0] == '/' || (I[0] == '.' && (I[1] == '\0' || (I[1] == '.' && (I[2] == '\0' || I[2] == '/')) || I[1] == '/')))) { if (AddVolatileFile(I, VolatileCmdL)) ; @@ -634,7 +633,7 @@ void pkgSourceList::AddVolatileFiles(CommandLine &CmdL, std::vector void pkgSourceList::AddVolatileFiles(CommandLine &CmdL, std::vector * const VolatileCmdL) { std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const * const I) { - if (I != nullptr && (I[0] == '/' || (I[0] == '.' && ((I[1] == '.' && I[2] == '/') || I[1] == '/')))) + if (I != nullptr && (I[0] == '/' || (I[0] == '.' && (I[1] == '\0' || (I[1] == '.' && (I[2] == '\0' || I[2] == '/')) || I[1] == '/')))) { if (AddVolatileFile(I)) {