summaryrefslogtreecommitdiff
path: root/ndb/src
diff options
context:
space:
mode:
authorunknown <gni/root@dev3-127.(none)>2006-10-08 11:24:53 +0800
committerunknown <gni/root@dev3-127.(none)>2006-10-08 11:24:53 +0800
commit705060f10ccb6a0e3ce5899f7d8c2fdfc2a6a777 (patch)
treec9dd99788b630eb2515bb93c6c0a08603a3e3c69 /ndb/src
parent861425a0da7a1a1f07939e5f1f94b3a3afced0be (diff)
downloadmariadb-git-705060f10ccb6a0e3ce5899f7d8c2fdfc2a6a777.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.
Diffstat (limited to 'ndb/src')
-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 12626f29e7d..00741d3a576 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;
}