Copy the data that the child read into the caller's buffer. This can't
have been used in half a decade at least...
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
struct aio_fork_pread_state {
struct aio_child *child;
struct aio_fork_pread_state {
struct aio_child *child;
+ size_t n;
+ void *data;
ssize_t ret;
struct vfs_aio_state vfs_aio_state;
};
ssize_t ret;
struct vfs_aio_state vfs_aio_state;
};
if (req == NULL) {
return NULL;
}
if (req == NULL) {
return NULL;
}
+ state->n = n;
+ state->data = data;
if (n > 128*1024) {
/* TODO: support variable buffers */
if (n > 128*1024) {
/* TODO: support variable buffers */
- state->child->busy = false;
-
retbuf = (struct rw_ret *)buf;
state->ret = retbuf->size;
state->vfs_aio_state.error = retbuf->ret_errno;
state->vfs_aio_state.duration = retbuf->duration;
retbuf = (struct rw_ret *)buf;
state->ret = retbuf->size;
state->vfs_aio_state.error = retbuf->ret_errno;
state->vfs_aio_state.duration = retbuf->duration;
+
+ if ((size_t)state->ret > state->n) {
+ tevent_req_error(req, EIO);
+ state->child->busy = false;
+ return;
+ }
+ memcpy(state->data, state->child->map->ptr, state->ret);
+
+ state->child->busy = false;
+