]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
util: Don't trigger truncate heuristic
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 9 May 2018 18:05:30 +0000 (14:05 -0400)
committerKefu Chai <tchaikov@gmail.com>
Fri, 11 May 2018 00:46:01 +0000 (08:46 +0800)
Derive the amount of space from the destination, not the source.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
util/status.cc

index 1881c58de0b94b5d29d7568289552fa37262c315..71ad99d8fb9b99443e2a2da727f9f7ae9ae96dc1 100644 (file)
@@ -24,7 +24,7 @@ const char* Status::CopyState(const char* state) {
   ret = strncpy_s(result, cch, state, cch - 1);
   assert(ret == 0);
 #else
-  std::strncpy(result, state, cch - 1);
+  std::strncpy(result, state, sizeof(result) - 1);
 #endif
   return result;
 }