From 1308225cc425208edd44f8fc5fd3cb34268afa14 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 13 Jan 2014 15:50:29 -0800 Subject: [PATCH] buffer: do not append trailing newline when appending empty istream If we call bl.append(some_istream); do not include a \n if the istream is empty (which is apparently is not the same thing as eof). This was causing 'ceph pg getmap' to include a trailing newline. Probably we don't want this newline at all! But all callers need to be fixed for that change. Signed-off-by: Sage Weil --- src/common/buffer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index be74879e71eb5..5c57763264b72 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -1279,7 +1279,8 @@ void buffer::list::rebuild_page_aligned() std::string s; getline(in, s); append(s.c_str(), s.length()); - append("\n", 1); + if (s.length()) + append("\n", 1); } } -- 2.39.5