]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kv/MemDB: fix MemDB::_init()
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 14 Jul 2016 10:56:41 +0000 (18:56 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 14 Jul 2016 11:34:07 +0000 (19:34 +0800)
1. mkdir() returns zero on success, or -1 if an error
   occurred (in which case, errno is set appropriately).
2. we shall return the proper error result to caller on failure.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/kv/MemDB.cc

index 8976e51f8cfb7a4df1a3563eee7813e5419bf6cf..0a67ca2886777583e873a337fa0a71997c6c0500 100644 (file)
@@ -134,8 +134,10 @@ int MemDB::_init(bool create)
   if (create) {
     int r = ::mkdir(m_db_path.c_str(), 0700);
     if (r < 0) {
-      if (r != EEXIST) {
+      r = -errno;
+      if (r != -EEXIST) {
         derr << __func__ << " mkdir failed: " << cpp_strerror(r) << dendl;
+        return r;
       }
     }
  } else {