]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Coverity: 1466057 Unchecked return value
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 1 Apr 2022 10:26:00 +0000 (12:26 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 1 Apr 2022 10:30:22 +0000 (12:30 +0200)
pdns/misc.cc

index ac5f74888bb3bef956e8b720d6ffc08a3786c69c..92318063f6050eb588cc8b72b44b3c097115a391 100644 (file)
@@ -826,12 +826,10 @@ bool readFileIfThere(const char* fname, std::string* line)
 {
   line->clear();
   auto fp = std::unique_ptr<FILE, int(*)(FILE*)>(fopen(fname, "r"), fclose);
-  if(!fp)
+  if (!fp) {
     return false;
-  stringfgets(fp.get(), *line);
-  fp.reset();
-
-  return true;
+  }
+  return stringfgets(fp.get(), *line);
 }
 
 Regex::Regex(const string &expr)