public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Fix return value on aio_read/write success
Date: Tue, 07 Aug 2018 07:49:00 -0000	[thread overview]
Message-ID: <20180807074940.46884.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b1952c03a8d6970f0fb4bcfffb9cfb5b525884d6

commit b1952c03a8d6970f0fb4bcfffb9cfb5b525884d6
Author: Mark Geisert <mark@maxrnd.com>
Date:   Mon Aug 6 22:54:06 2018 -0700

    Fix return value on aio_read/write success
    
    Internally track resultant byte counts as ssize_t, but return 0 as int
    for success indication, per POSIX.

Diff:
---
 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 fe63dec..7d5d982 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


                 reply	other threads:[~2018-08-07  7:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180807074940.46884.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).