From: David Zafman Date: Wed, 20 Nov 2019 19:55:15 +0000 (-0800) Subject: tools: odsmaptool truncate target upmap file X-Git-Tag: v15.1.0~712^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a49324ceb9c322f792ea00720f438ea9ea09555f;p=ceph.git tools: odsmaptool truncate target upmap file Signed-off-by: David Zafman --- diff --git a/src/tools/osdmaptool.cc b/src/tools/osdmaptool.cc index 1190dc2bc281..b3455f85fa0d 100644 --- a/src/tools/osdmaptool.cc +++ b/src/tools/osdmaptool.cc @@ -350,7 +350,7 @@ int main(int argc, const char **argv) int upmap_fd = STDOUT_FILENO; if (upmap || upmap_cleanup) { if (upmap_file != "-") { - upmap_fd = ::open(upmap_file.c_str(), O_CREAT|O_WRONLY, 0644); + upmap_fd = ::open(upmap_file.c_str(), O_CREAT|O_WRONLY|O_TRUNC, 0644); if (upmap_fd < 0) { cerr << "error opening " << upmap_file << ": " << cpp_strerror(errno) << std::endl;