From: Alex Rousskov Date: Thu, 3 Feb 2011 17:13:39 +0000 (-0700) Subject: Avoid assertions when mgr:storedir is requested before cache_dir has a map. X-Git-Tag: take02~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=714a769f772fe5732068bd7a4f2f5d29d4ec54f9;p=thirdparty%2Fsquid.git Avoid assertions when mgr:storedir is requested before cache_dir has a map. --- diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index dc01e24b0e..00e7825160 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -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);