Просмотр исходного кода

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

Closes: #153161
Julian Andres Klode лет назад: 11
Родитель
Сommit
714c23a791
1 измененных файлов с 6 добавлено и 1 удалено
  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;