]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Avoid assertions when mgr:storedir is requested before cache_dir has a map.
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 3 Feb 2011 17:13:39 +0000 (10:13 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 3 Feb 2011 17:13:39 +0000 (10:13 -0700)
src/fs/rock/RockSwapDir.cc

index dc01e24b0e07f1ffb652f78981564497e0d76572..00e7825160f5d9c8777f7c3df7716292b5054035 100644 (file)
@@ -624,9 +624,13 @@ Rock::SwapDir::statfs(StoreEntry &e) const
     storeAppendPrintf(&e, "Current Size: %"PRIu64" KB %.2f%%\n", cur_size,
                       100.0 * cur_size / max_size);
 
-    storeAppendPrintf(&e, "Maximum entries: %9d\n", map->entryLimit());
-    storeAppendPrintf(&e, "Current entries: %9d %.2f%%\n",
-        map->entryCount(), (100.0 * map->entryCount() / map->entryLimit()));
+    if (map) {
+        const int limit = map->entryLimit();
+        storeAppendPrintf(&e, "Maximum entries: %9d\n", limit);
+        if (limit > 0)
+            storeAppendPrintf(&e, "Current entries: %9d %.2f%%\n",
+                map->entryCount(), (100.0 * map->entryCount() / limit));
+    }    
 
     storeAppendPrintf(&e, "Pending operations: %d out of %d\n",
         store_open_disk_fd, Config.max_open_disk_fds);