]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debindexfile.cc
Bug #807012 also involves package dependencies :/.
[apt.git] / apt-pkg / deb / debindexfile.cc
index 9be2db4c95667a16035ae9bfcf26c0ff547ba1b9..c55847305ff96c4038c64eae425a6b173f0d28e2 100644 (file)
@@ -30,6 +30,7 @@
 #include <sstream>
 
 #include <sys/stat.h>
+#include <unistd.h>
                                                                        /*}}}*/
 
 // Sources Index                                                       /*{{{*/
@@ -80,7 +81,11 @@ debPackagesIndex::debPackagesIndex(IndexTarget const &Target, bool const Trusted
 std::string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator const &Ver) const
 {
    std::string Res = Target.Description;
-   Res.erase(Target.Description.rfind(' '));
+   {
+      auto const space = Target.Description.rfind(' ');
+      if (space != std::string::npos)
+        Res.erase(space);
+   }
 
    Res += " ";
    Res += Ver.ParentPkg().Name();
@@ -194,7 +199,7 @@ bool debDebPkgFileIndex::GetContent(std::ostream &content, std::string const &de
       return _error->Error("Popen failed");
 
    content << "Filename: " << debfile << "\n";
-   content << "Size: " << Buf.st_size << "\n";
+   content << "Size: " << std::to_string(Buf.st_size) << "\n";
    bool first_line_seen = false;
    char buffer[1024];
    do {