Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/common/buffer.cc fix judgment for lseek #10130

Merged
merged 1 commit into from Jul 18, 2016

Conversation

yonghengdexin735
Copy link
Contributor

lseek() returns the resulting offset location as measured in bytes from the beginning of the file. On error, the value (off_t) -1 is returned and errno is set to indicate the error. And this errno returned ESPIPE.

Signed-off-by: zhang.zezhu zhang.zezhu@zte.com.cn

@gaowanlong
Copy link
Contributor

better to write the log into commit message, too. otherwise lgtm.

@songbaisen
Copy link

@gaowanlong 😄 Hello,Do you remember the "xiayuhe" stand near by "nanhu" park.

@@ -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)
if (offset < 0 && errno != ESPIPE)
return (int) offset;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:
return -errno

Signed-off-by: zhang.zezhu <zhang.zezhu@zte.com.cn>
@yonghengdexin735
Copy link
Contributor Author

@xiexingguo thank you for comment, I fixed it

@xiexingguo
Copy link
Member

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants