From bfa40363b2d8fc25b4aed0164579d55137ac9e8b Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 4 May 2016 14:54:32 +0800 Subject: [PATCH] mon/Monitor: use VOID_TEMP_FAILURE_RETRY wrapper for fd close(). This is safer and much more robust. Signed-off-by: xie xingguo --- src/mon/Monitor.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index beea5e8b7b477..71c3727005892 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -86,6 +86,7 @@ #include "common/config.h" #include "common/cmdparse.h" #include "include/assert.h" +#include "include/compat.h" #define dout_subsys ceph_subsys_mon #undef dout_prefix @@ -5018,7 +5019,7 @@ int Monitor::write_default_keyring(bufferlist& bl) err = bl.write_fd(fd); if (!err) ::fsync(fd); - ::close(fd); + VOID_TEMP_FAILURE_RETRY(::close(fd)); return err; } -- 2.39.5