From 0fa8e298972dca28f32ede327dfb0fd8ff5b5f12 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Thu, 18 Mar 2021 23:35:07 +0100 Subject: [PATCH] Fix metadata dump() output --- src/dwarfs/metadata_v2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dwarfs/metadata_v2.cpp b/src/dwarfs/metadata_v2.cpp index 815e91eb..061e7c10 100644 --- a/src/dwarfs/metadata_v2.cpp +++ b/src/dwarfs/metadata_v2.cpp @@ -621,8 +621,9 @@ void metadata_::dump( if (auto ts = meta_.create_timestamp()) { time_t tp = *ts; - std::string str(20, '\0'); - std::strftime(str.data(), str.size(), "%F %T", std::localtime(&tp)); + std::string str(32, '\0'); + str.resize( + std::strftime(str.data(), str.size(), "%F %T", std::localtime(&tp))); os << "created on: " << str << std::endl; } @@ -633,7 +634,7 @@ void metadata_::dump( } if (detail_level > 1) { - os << "inode_count: " << inode_count_; + os << "inode_count: " << inode_count_ << std::endl; os << "symlink_inode_offset: " << symlink_inode_offset_ << std::endl; os << "file_inode_offset: " << file_inode_offset_ << std::endl; os << "dev_inode_offset: " << dev_inode_offset_ << std::endl;