]> git.saurik.com Git - apt.git/commitdiff
Fix crash in "apt list" when a sources.list file is unreable
authorMichael Vogt <mvo@debian.org>
Fri, 4 Apr 2014 10:16:22 +0000 (12:16 +0200)
committerMichael Vogt <mvo@debian.org>
Fri, 4 Apr 2014 10:16:22 +0000 (12:16 +0200)
Closes: 743413
apt-private/private-list.cc
apt-private/private-list.h
cmdline/apt.cc

index 7664ca1348cd369f91833e83c5a1de8e81e9ded3..b053cbcbe2bfb2d120f86d3781b72fe31a760236 100644 (file)
@@ -99,14 +99,13 @@ static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/
                                                                        /*}}}*/
 // list - list package based on criteria                               /*{{{*/
 // ---------------------------------------------------------------------
-bool List(CommandLine &Cmd)
+bool DoList(CommandLine &Cmd)
 {
    pkgCacheFile CacheFile;
    pkgCache *Cache = CacheFile.GetPkgCache();
-   pkgRecords records(CacheFile);
-
    if (unlikely(Cache == NULL))
       return false;
+   pkgRecords records(CacheFile);
 
    const char **patterns;
    const char *all_pattern[] = { "*", NULL};
index 461f527cb24c2f1382f66cd07e198ad8e3f80b4d..aa267776488549e6f7b6a7ee71abec6409a54a6d 100644 (file)
@@ -5,7 +5,7 @@
 
 class CommandLine;
 
-APT_PUBLIC bool List(CommandLine &Cmd);
+APT_PUBLIC bool DoList(CommandLine &Cmd);
 
 
 #endif
index 778ca5a80d6ed1cef4251d61a4207e78119a5a4d..4813861a441a61d88cc8c93758a535d2fc07a8e8 100644 (file)
@@ -70,7 +70,7 @@ int main(int argc, const char *argv[])                                        /*{{{*/
 {
    CommandLine::Dispatch Cmds[] = {
                                    // query
-                                   {"list",&List},
+                                   {"list",&DoList},
                                    {"search", &FullTextSearch},
                                    {"show", &APT::Cmd::ShowPackage},