From 5dcb22addb1cee76d44f14b652a3a9577d774ab6 Mon Sep 17 00:00:00 2001 From: "zhang.zezhu" Date: Tue, 5 Jul 2016 04:08:25 +0000 Subject: [PATCH] src/common/buffer.cc fix judgment for lseek Signed-off-by: zhang.zezhu --- src/common/buffer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 785a210fb96..f941428ec84 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -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::const_iterator it = _buffers.begin(); it != _buffers.end(); ++it) { -- 2.47.3