diff options
author | gni/root@dev3-127.(none) <> | 2006-10-08 11:35:03 +0800 |
---|---|---|
committer | gni/root@dev3-127.(none) <> | 2006-10-08 11:35:03 +0800 |
commit | 72b7e5597b11114cafb0e8ae3c14252a357c9a2c (patch) | |
tree | 1959d74c9e8fe08887709305eb464533b3a3db60 | |
parent | b52d86cff36b747e7fc9a1dcefddf614c1928a27 (diff) | |
download | mariadb-git-72b7e5597b11114cafb0e8ae3c14252a357c9a2c.tar.gz |
BUG #21858 Make sure retry when EINTR returns, which decreases memory leak chance.
-rw-r--r-- | ndb/src/common/util/File.cpp | 18 |
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; } |