]> 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>
Tue, 3 Dec 2019 01:36:02 +0000 (17:36 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit a49324ceb9c322f792ea00720f438ea9ea09555f)

src/tools/osdmaptool.cc

index 8847589b1a0be796f1d5af9c4c828fcbfadf69f6..2eb0d12c62985fef9d8b621dd9e5ef06b2067f88 100644 (file)
@@ -342,7 +342,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;