HDFS-12013: libhdfs++: read with offset at EOF should return 0 bytes instead of error. Contributed by Xiaowei Zhu

This commit is contained in:
James Clampffer 2017-07-07 14:04:42 -04:00
parent c5e7a69523
commit 3c743b475e

View File

@ -181,7 +181,10 @@ void FileHandleImpl::AsyncPreadSome(
return; return;
} }
if(offset >= file_info_->file_length_){ if(offset == file_info_->file_length_) {
handler(Status::OK(), "", 0);
return;
} else if(offset > file_info_->file_length_){
handler(Status::InvalidOffset("AsyncPreadSome: trying to begin a read past the EOF"), "", 0); handler(Status::InvalidOffset("AsyncPreadSome: trying to begin a read past the EOF"), "", 0);
return; return;
} }