Эх сурвалжийг харах

close opened file descriptors properly

Bryon Gloden, CISSP® 9 жил өмнө
parent
commit
a375e1acfd

+ 1 - 0
src/google/protobuf/testing/file.cc

@@ -91,6 +91,7 @@ bool File::WriteStringToFile(const string& contents, const string& name) {
 
   if (fwrite(contents.data(), 1, contents.size(), file) != contents.size()) {
     GOOGLE_LOG(ERROR) << "fwrite(" << name << "): " << strerror(errno);
+    fclose(file);
     return false;
   }