summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-08-17 20:35:47 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-08-17 20:35:47 +0200
commit1485040e1b6b0b7ef706bf9552698e4c8e82051f (patch)
treef22a7ccbade05fe85bfc5ec984c61f097b3d6dd9
parent8bd823d0a1f7e08ad94a7110bb118f73348133a1 (diff)
downloadapt-1485040e1b6b0b7ef706bf9552698e4c8e82051f.tar.gz
don't count each Type as an individual deb822-sources stanza
Reported-By: Mattia Rizzolo <mattia@debian.org> in #834629
-rw-r--r--apt-pkg/sourcelist.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index f4a84cc9b..cfd824978 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;