]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Coverity 1487743: Unchecked return value
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 6 Apr 2022 09:54:04 +0000 (11:54 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 6 Apr 2022 09:54:04 +0000 (11:54 +0200)
pdns/misc.cc

index 92318063f6050eb588cc8b72b44b3c097115a391..cc82005588c1fac913425a39ecb27d51a95d7479 100644 (file)
@@ -232,8 +232,10 @@ string nowTime()
   localtime_r(&now, &tm);
   char buffer[30];
   // YYYY-mm-dd HH:MM:SS TZOFF
-  strftime(buffer, sizeof(buffer), "%F %T %z", &tm);
-  buffer[sizeof(buffer)-1] = '\0';
+  size_t ret = strftime(buffer, sizeof(buffer), "%F %T %z", &tm);
+  if (ret == 0) {
+    buffer[0] = '\0';
+  }
   return string(buffer);
 }