]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer: do not append trailing newline when appending empty istream
authorSage Weil <sage@inktank.com>
Mon, 13 Jan 2014 23:50:29 +0000 (15:50 -0800)
committerSage Weil <sage@inktank.com>
Mon, 13 Jan 2014 23:52:13 +0000 (15:52 -0800)
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 <sage@inktank.com>
src/common/buffer.cc

index be74879e71eb53597b34001e9b26d7b60ee1a4fe..5c57763264b72edec9cc4e7f85576e72ad2c17a4 100644 (file)
@@ -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);
     }
   }