summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <gni/root@dev3-127.(none)>2006-10-08 11:35:03 +0800
committerunknown <gni/root@dev3-127.(none)>2006-10-08 11:35:03 +0800
commit32a0f4e53481c37d7c463f0d2b12e2e62876bc85 (patch)
tree1959d74c9e8fe08887709305eb464533b3a3db60
parente9d019f72739390b153ab962cb2e011c69834844 (diff)
downloadmariadb-git-32a0f4e53481c37d7c463f0d2b12e2e62876bc85.tar.gz
BUG #21858 Make sure retry when EINTR returns, which decreases memory leak chance.
ndb/src/common/util/File.cpp: Avoid memory leak when EINTR error returns, Even though a close error happens, a ERROR message in out-file is given, and this shouldn't affect the normally running.
-rw-r--r--ndb/src/common/util/File.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp
index 056b7ff199b..33d6ca1d535 100644
--- a/ndb/src/common/util/File.cpp
+++ b/ndb/src/common/util/File.cpp
@@ -123,13 +123,25 @@ bool
File_class::close()
{
bool rc = true;
+ int retval = 0;
+
if (m_file != NULL)
{
::fflush(m_file);
- rc = (::fclose(m_file) == 0 ? true : false);
- m_file = NULL; // Try again?
+ retval = ::fclose(m_file);
+ while ( (retval != 0) && (errno == EINTR) ){
+ retval = ::fclose(m_file);
+ }
+ if( retval == 0){
+ rc = true;
+ }
+ else {
+ rc = false;
+ ndbout_c("ERROR: Close file error in File.cpp for %s",strerror(errno));
+ }
}
-
+ m_file = NULL;
+
return rc;
}