]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/common/buffer.cc fix judgment for lseek 10130/head
authorzhang.zezhu <zhang.zezhu@zte.com.cn>
Tue, 5 Jul 2016 04:08:25 +0000 (04:08 +0000)
committerzhang.zezhu <zhang.zezhu@zte.com.cn>
Thu, 7 Jul 2016 12:00:37 +0000 (12:00 +0000)
Signed-off-by: zhang.zezhu <zhang.zezhu@zte.com.cn>
src/common/buffer.cc

index 785a210fb963111157355ca306d020936b9666ca..f941428ec840788b788004e5ee7f70c6a7d4a9cb 100644 (file)
@@ -2293,9 +2293,9 @@ int buffer::list::write_fd_zero_copy(int fd) const
    */
   int64_t offset = ::lseek(fd, 0, SEEK_CUR);
   int64_t *off_p = &offset;
-  if (offset < 0 && offset != ESPIPE)
-    return (int) offset;
-  if (offset == ESPIPE)
+  if (offset < 0 && errno != ESPIPE)
+    return -errno;
+  if (errno == ESPIPE)
     off_p = NULL;
   for (std::list<ptr>::const_iterator it = _buffers.begin();
        it != _buffers.end(); ++it) {