From 3b720f5a62f585881da138f76bfee4ca09df6d61 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Tue, 5 May 2015 01:44:05 +0200 Subject: [PATCH] tools/rados/rados.cc: restore ostream format CID 717133 (#1 of 1): Not restoring ostream format (STREAM_FORMAT_STATE) 95. format_changed: fill changes the format state of std::cout for category fill. 100. end_of_path: Changing format state of stream std::cout for category fill without later restoring it. Signed-off-by: Danny Al-Gaaf --- src/tools/rados/rados.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index f9e4ee6637f4a..8cc55eddc7d87 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -2206,6 +2206,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, localtime_r(&t, &bdt); cout << *i << "\t" << s << "\t"; + std::ios_base::fmtflags original_flags = cout.flags(); cout.setf(std::ios::right); cout.fill('0'); cout << std::setw(4) << (bdt.tm_year+1900) @@ -2216,7 +2217,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, << ':' << std::setw(2) << bdt.tm_min << ':' << std::setw(2) << bdt.tm_sec << std::endl; - cout.unsetf(std::ios::right); + cout.flags(original_flags); } cout << snaps.size() << " snaps" << std::endl; } -- 2.39.5