]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: odsmaptool truncate target upmap file
authorDavid Zafman <dzafman@redhat.com>
Wed, 20 Nov 2019 19:55:15 +0000 (11:55 -0800)
committerDavid Zafman <dzafman@redhat.com>
Wed, 15 Jan 2020 21:10:37 +0000 (21:10 +0000)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit a49324ceb9c322f792ea00720f438ea9ea09555f)

src/tools/osdmaptool.cc

index 1299d342939d0380f5558044e5435791d3406008..605c1945a49c04521c5d74d5d1791001a0d6bb2d 100644 (file)
@@ -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;