diff options
author | Julian Andres Klode <jak@debian.org> | 2018-05-24 13:04:22 +0000 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2018-05-24 13:04:22 +0000 |
commit | 6eaeec549241677335813af78f394010e5b3eefb (patch) | |
tree | 2860b6b7472c0b8c8b4dbd4e577d06bed465aece /apt-pkg/deb/debindexfile.cc | |
parent | b367f2d393fa95a386feb03a64d4bf5e32cc28a4 (diff) | |
parent | 6085ab7488326cfed8f82e07eefcbc2dc40d4bea (diff) |
Merge branch 'feature/morevolatilesupport' into 'master'
more volatile: build-dep foo.deb/release & show foo.deb
See merge request apt-team/apt!14
Diffstat (limited to 'apt-pkg/deb/debindexfile.cc')
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 10ebd1d3e..f7e3c7a5c 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -185,28 +185,22 @@ bool debDebPkgFileIndex::GetContent(std::ostream &content, std::string const &de if(Popen((const char**)&Args[0], PipeFd, Child, FileFd::ReadOnly) == false) return _error->Error("Popen failed"); - content << "Filename: " << debfile << "\n"; - content << "Size: " << std::to_string(Buf.st_size) << "\n"; + std::string line; bool first_line_seen = false; - char buffer[1024]; - do { - unsigned long long actual = 0; - if (PipeFd.Read(buffer, sizeof(buffer)-1, &actual) == false) - return _error->Errno("read", "Failed to read dpkg pipe"); - if (actual == 0) - break; - buffer[actual] = '\0'; - char const * b = buffer; + while (PipeFd.ReadLine(line)) + { if (first_line_seen == false) { - for (; *b != '\0' && (*b == '\n' || *b == '\r'); ++b) - /* skip over leading newlines */; - if (*b == '\0') + if (line.empty()) continue; first_line_seen = true; } - content << b; - } while(true); + else if (line.empty()) + break; + content << line << "\n"; + } + content << "Filename: " << debfile << "\n"; + content << "Size: " << std::to_string(Buf.st_size) << "\n"; ExecWait(Child, "Popen"); return true; |