From a49324ceb9c322f792ea00720f438ea9ea09555f Mon Sep 17 00:00:00 2001 From: David Zafman Date: Wed, 20 Nov 2019 11:55:15 -0800 Subject: [PATCH] tools: odsmaptool truncate target upmap file Signed-off-by: David Zafman --- src/tools/osdmaptool.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/osdmaptool.cc b/src/tools/osdmaptool.cc index 1190dc2bc2816..b3455f85fa0d0 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; -- 2.39.5