]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed negative time value detection and removed "pointless comparison with 0"
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 14 Sep 2011 19:59:30 +0000 (13:59 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 14 Sep 2011 19:59:30 +0000 (13:59 -0600)
to make ICC compiler happier.

src/fs/rock/RockSwapDir.cc

index 898e0099f2d635dc48617745c45e1fd7fef18cf2..b580f0b4d73a812b7f2d9af598b3f61a4ba365bb 100644 (file)
@@ -310,13 +310,15 @@ Rock::SwapDir::parseTimeOption(char const *option, const char *value, int reconf
     if (!value)
         self_destruct();
 
-    const time_msec_t newTime = strtoll(value, NULL, 10);
-
-    if (newTime < 0) {
-        debugs(3, DBG_CRITICAL, "FATAL: cache_dir " << path << ' ' << option << " must not be negative but is: " << newTime);
+    // TODO: handle time units and detect parsing errors better
+    const int64_t parsedValue = strtoll(value, NULL, 10);
+    if (parsedValue < 0) {
+        debugs(3, DBG_CRITICAL, "FATAL: cache_dir " << path << ' ' << option << " must not be negative but is: " << parsedValue);
         self_destruct();
     }
 
+    const time_msec_t newTime = static_cast<time_msec_t>(parsedValue);
+
     if (reconfiguring && *storedTime != newTime)
         debugs(3, DBG_IMPORTANT, "cache_dir " << path << ' ' << option << " is now " << newTime);