a read can sometimes span beyond the end of file.
In which case individual smal read chunks beyond the end of file will return OK, 0 bytes of data and EOF==1
For this case, trap when len==0 and ignore these chunks.
Do not update the read-count if / when len is 0.
#define SERVER "10.1.1.27"
#define EXPORT "/VIRTUAL"
#define SERVER "10.1.1.27"
#define EXPORT "/VIRTUAL"
-#define NFSFILE "/BOOKS/Classics/Dracula.djvu"
+#define NFSFILE "/BOOKS/Classics/Dracula.djvu.truncated"
#define NFSFILER "/BOOKS/Classics/Dracula.djvu.renamed"
#define NFSFILEW "/BOOKS/Classics/foo"
#define NFSDIR "/BOOKS/Classics/"
#define NFSFILER "/BOOKS/Classics/Dracula.djvu.renamed"
#define NFSFILEW "/BOOKS/Classics/foo"
#define NFSDIR "/BOOKS/Classics/"
int main(int argc _U_, char *argv[] _U_)
{
int main(int argc _U_, char *argv[] _U_)
{
if (res->status != NFS3_OK) {
rpc_set_error(nfs->rpc, "NFS: Read failed with %s(%d)", nfsstat3_to_str(res->status), nfsstat3_to_errno(res->status));
data->error = 1;
if (res->status != NFS3_OK) {
rpc_set_error(nfs->rpc, "NFS: Read failed with %s(%d)", nfsstat3_to_str(res->status), nfsstat3_to_errno(res->status));
data->error = 1;
- } else {
- memcpy(&data->buffer[mdata->offset - data->start_offset], res->READ3res_u.resok.data.data_val, res->READ3res_u.resok.count);
- if ((unsigned)data->max_offset < mdata->offset + res->READ3res_u.resok.count) {
- data->max_offset = mdata->offset + res->READ3res_u.resok.count;
+ } else {
+ if (res->READ3res_u.resok.count > 0) {
+ memcpy(&data->buffer[mdata->offset - data->start_offset], res->READ3res_u.resok.data.data_val, res->READ3res_u.resok.count);
+ if ((unsigned)data->max_offset < mdata->offset + res->READ3res_u.resok.count) {
+ data->max_offset = mdata->offset + res->READ3res_u.resok.count;
+ }