when a multi-read was completely beyond the end of file, this caused us to invoke the callback with a 'read-count' of <0 which the callback would treat as a failure.
This would then cause the callback to treat the data pointer as an error string and try to use it for nfs_set_error().
Since the data pointer was actually a real binary databuffer and not an error string this would cause the NFS error string to look like it contained garbage data.
In this case, where the multi-read fails to read any data at all since it if fully beyond end of file, make sure to invoke the callback with a read-count of 0
}
data->nfsfh->offset = data->max_offset;
- data->cb(data->max_offset - data->start_offset, nfs, data->buffer, data->private_data);
+ if (data->max_offset - data->start_offset >= 0) {
+ data->cb(data->max_offset - data->start_offset, nfs, data->buffer, data->private_data);
+ } else {
+ data->cb(0, nfs, data->buffer, data->private_data);
+ }
free_nfs_cb_data(data);
free(mdata);
}