From: Sage Weil Date: Mon, 13 Jan 2014 23:50:29 +0000 (-0800) Subject: buffer: do not append trailing newline when appending empty istream X-Git-Tag: v0.77~20^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1308225cc425208edd44f8fc5fd3cb34268afa14;p=ceph.git 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 --- diff --git a/src/common/buffer.cc b/src/common/buffer.cc index be74879e71eb..5c57763264b7 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); } }