summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Geisert <mark@maxrnd.com>2018-08-06 22:54:06 -0700
committerCorinna Vinschen <corinna@vinschen.de>2018-08-07 09:49:18 +0200
commitb1952c03a8d6970f0fb4bcfffb9cfb5b525884d6 (patch)
treecee7e4cde757807b4fef85a649fda42de6eb1114
parentf16b198c3b033ae60af9efcb045ebf68361950ad (diff)
downloadcygnal-b1952c03a8d6970f0fb4bcfffb9cfb5b525884d6.tar.gz
cygnal-b1952c03a8d6970f0fb4bcfffb9cfb5b525884d6.tar.bz2
cygnal-b1952c03a8d6970f0fb4bcfffb9cfb5b525884d6.zip
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.
-rw-r--r--winsup/cygwin/aio.cc8
1 files 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