Procházet zdrojové kódy

apt-cache: Show an error if stats gets any arguments

Closes: #153161
Julian Andres Klode před 11 roky
rodič
revize
714c23a791
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      cmdline/apt-cache.cc

+ 6 - 1
cmdline/apt-cache.cc

@@ -310,10 +310,15 @@ static void ShowHashTableStats(std::string Type,
 // Stats - Dump some nice statistics					/*{{{*/
 // ---------------------------------------------------------------------
 /* */
-static bool Stats(CommandLine &)
+static bool Stats(CommandLine &CmdL)
 {
    pkgCacheFile CacheFile;
    pkgCache *Cache = CacheFile.GetPkgCache();
+
+   if (CmdL.FileSize() > 1) {
+      _error->Error(_("apt-cache stats does not take any arguments"));
+      return false;
+   }
    if (unlikely(Cache == NULL))
       return false;