]> 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>
Thu, 28 Nov 2019 00:29:29 +0000 (16:29 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/osdmaptool.cc

index 1190dc2bc2816f2f2dd882eecf9bdc7ab962269a..b3455f85fa0d03d4615bc7055f9748ded168d4e4 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;