From: Yehuda Sadeh Date: Fri, 26 Apr 2013 04:30:30 +0000 (-0700) Subject: rgw: fix plain formatter flush X-Git-Tag: v0.61~88^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=960eac26004849d6e2fa61cfab6482e9db667c52;p=ceph.git rgw: fix plain formatter flush The plain formatter flush needs to append eol if needed, and not to clear the sections stack. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_formats.cc b/src/rgw/rgw_formats.cc index 61d4d04c7a4f..66704c4f5bb6 100644 --- a/src/rgw/rgw_formats.cc +++ b/src/rgw/rgw_formats.cc @@ -36,18 +36,25 @@ void RGWFormatter_Plain::flush(ostream& os) if (!buf) return; - os << buf; - os.flush(); - reset(); + if (len) { + os << buf << "\n"; + os.flush(); + } + + reset_buf(); } -void RGWFormatter_Plain::reset() +void RGWFormatter_Plain::reset_buf() { free(buf); buf = NULL; len = 0; max_len = 0; +} +void RGWFormatter_Plain::reset() +{ + reset_buf(); stack.clear(); min_stack_level = 0; } diff --git a/src/rgw/rgw_formats.h b/src/rgw/rgw_formats.h index 29767851d5f2..0ae917fe7d1a 100644 --- a/src/rgw/rgw_formats.h +++ b/src/rgw/rgw_formats.h @@ -17,6 +17,7 @@ struct plain_stack_entry { * There is a much better way to do this. */ class RGWFormatter_Plain : public Formatter { + void reset_buf(); public: RGWFormatter_Plain(); virtual ~RGWFormatter_Plain();