summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-12-11 16:55:31 -0500
committerRich Felker <dalias@aerifal.cx>2018-12-11 16:55:31 -0500
commitc00cdefa1da17f60b3179704528582ef320e61b8 (patch)
treec9e31359b07fb132180b243d73b0b8418f49711e
parenta9a9882fbe089a0a9f562d8ecd4c96e52b3548f1 (diff)
downloadmusl-c00cdefa1da17f60b3179704528582ef320e61b8.tar.gz
on failed aio submission, set aiocb error and return value
it's not clear whether this is required, but it seems arguable that it should happen. for example aio_suspend is supposed to return immediately if any of the operations has "completed", which includes ending with an error status asynchonously and might also be interpreted to include doing so synchronously.
-rw-r--r--src/aio/aio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/aio/aio.c b/src/aio/aio.c
index dae97cc6..6d34fa86 100644
--- a/src/aio/aio.c
+++ b/src/aio/aio.c
@@ -280,6 +280,8 @@ static int submit(struct aiocb *cb, int op)
if (!q) {
if (errno != EBADF) errno = EAGAIN;
+ cb->__ret = -1;
+ cb->__err = errno;
return -1;
}
q->ref++;
@@ -303,8 +305,8 @@ static int submit(struct aiocb *cb, int op)
if (pthread_create(&td, &a, io_thread_func, &args)) {
pthread_mutex_lock(&q->lock);
__aio_unref_queue(q);
- errno = EAGAIN;
- ret = -1;
+ cb->__err = errno = EAGAIN;
+ cb->__ret = ret = -1;
}
pthread_sigmask(SIG_SETMASK, &origmask, 0);