]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Restore ostream format state after changing it 52734/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Tue, 1 Aug 2023 18:14:06 +0000 (23:44 +0530)
committerVedansh Bhartia <vedanshbhartia@gmail.com>
Thu, 3 Aug 2023 07:38:49 +0000 (13:08 +0530)
Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
src/rgw/rgw_asio_frontend.cc
src/rgw/rgw_common.cc
src/rgw/rgw_public_access.cc

index 633a2963300f60b2e10c809a185daa2bc6f00a85..e373e4b4cf77143b2e490c02d99f94331a251f7e 100644 (file)
@@ -167,8 +167,15 @@ struct log_ms_remainder {
 };
 std::ostream& operator<<(std::ostream& out, const log_ms_remainder& m) {
   using namespace std::chrono;
-  return out << std::setfill('0') << std::setw(3)
+
+  std::ios oldState(nullptr);
+  oldState.copyfmt(out);
+
+  out << std::setfill('0') << std::setw(3)
       << duration_cast<milliseconds>(m.t.time_since_epoch()).count() % 1000;
+
+  out.copyfmt(oldState);
+  return out;
 }
 
 // log time in apache format: day/month/year:hour:minute:second zone
index 5868268c5e1b174a4e1b5a5349b581e0f7208ae1..a83168373ef23ec565644659a447edc2e4ad35d4 100644 (file)
@@ -286,10 +286,16 @@ req_state::~req_state() {
 
 std::ostream& req_state::gen_prefix(std::ostream& out) const
 {
-  auto p = out.precision();
-  return out << "req " << id << ' '
+  std::ios oldState(nullptr);
+  oldState.copyfmt(out);
+
+  out << "req " << id << ' '
       << std::setprecision(3) << std::fixed << time_elapsed() // '0.123s'
-      << std::setprecision(p) << std::defaultfloat << ' ';
+      << ' ';
+
+  out.copyfmt(oldState);
+  return out;
+
 }
 
 bool search_err(rgw_http_errors& errs, int err_no, int& http_ret, string& code)
index 6298bb306d87feae18821ab806572844406d2711..d388a59a7bb95518cf6490ccbac2a264d7ae961a 100644 (file)
@@ -22,12 +22,16 @@ void PublicAccessBlockConfiguration::dump_xml(Formatter *f) const {
 
 std::ostream& operator<< (std::ostream& os, const PublicAccessBlockConfiguration& access_conf)
 {
+    std::ios oldState(nullptr);
+    oldState.copyfmt(os);
+
     os << std::boolalpha
        << "BlockPublicAcls: " << access_conf.block_public_acls() << std::endl
        << "IgnorePublicAcls: " << access_conf.ignore_public_acls() << std::endl
        << "BlockPublicPolicy" << access_conf.block_public_policy() << std::endl
        << "RestrictPublicBuckets" << access_conf.restrict_public_buckets() << std::endl;
 
+    os.copyfmt(oldState);
     return os;
 }