]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer: write_fd should skip empty buffers
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 29 Jun 2010 22:59:20 +0000 (15:59 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 29 Jun 2010 23:00:05 +0000 (16:00 -0700)
src/common/buffer.cc

index aab9837685217c9cda95e18bb172a64a086e3fe4..4c9e33b404c403195845d513e268e9b3aec3567e 100644 (file)
@@ -132,8 +132,10 @@ int buffer::list::write_fd(int fd)
     for (std::list<ptr>::const_iterator it = _buffers.begin(); 
         it != _buffers.end(); 
         it++) {
-      const char *c = it->c_str();
       int left = it->length();
+      if (!left)
+        continue;
+      const char *c = it->c_str();
       while (left > 0) {
        int r = ::write(fd, c, left);
        if (r < 0)