[PATCH v2] Fix return value on aio_read/write success
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Aug 7 07:49:00 GMT 2018
On Aug 6 22:54, Mark Geisert wrote:
> Internally track resultant byte counts as ssize_t, but return 0 as int
> for success indication, per POSIX.
> ---
> winsup/cygwin/aio.cc | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/winsup/cygwin/aio.cc b/winsup/cygwin/aio.cc
> index fe63dec04..7d5d98299 100644
> --- a/winsup/cygwin/aio.cc
> +++ b/winsup/cygwin/aio.cc
> @@ -265,7 +265,7 @@ aiowaiter (void *unused)
> }
> }
>
> -static int
> +static ssize_t
> asyncread (struct aiocb *aio)
> { /* Try to initiate an asynchronous read, either from app or worker thread */
> ssize_t res = 0;
> @@ -296,7 +296,7 @@ asyncread (struct aiocb *aio)
> return res;
> }
>
> -static int
> +static ssize_t
> asyncwrite (struct aiocb *aio)
> { /* Try to initiate an asynchronous write, either from app or worker thread */
> ssize_t res = 0;
> @@ -712,7 +712,7 @@ aio_read (struct aiocb *aio)
> ; /* I think this is not possible */
> }
>
> - return res;
> + return res < 0 ? (int) res : 0; /* return 0 on success */
> }
>
> ssize_t
> @@ -902,7 +902,7 @@ aio_write (struct aiocb *aio)
> ; /* I think this is not possible */
> }
>
> - return res;
> + return res < 0 ? (int) res : 0; /* return 0 on success */
> }
>
> int
> --
> 2.17.0
Pushed.
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20180807/4d145496/attachment.sig>
More information about the Cygwin-patches
mailing list