Cygwin: file I/O: make sure to treat write return value as ssize_t

The return type of fhandler write methods is ssize_t.  Don't
use an int to store the return value, use ssize_t.  Use ptrdiff_t
for the buffer size.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2020-04-24 16:14:43 +02:00
parent 8a0bdd84b8
commit 5a7e130c31
1 changed files with 3 additions and 3 deletions

View File

@ -949,9 +949,9 @@ fhandler_base::write (const void *ptr, size_t len)
}
/* We've got a buffer-full, or we're out of data. Write it out */
int nbytes;
int want = buf_ptr - buf;
if ((nbytes = raw_write (buf, want)) == want)
ssize_t nbytes;
ptrdiff_t want = buf_ptr - buf;
if ((nbytes = raw_write (buf, (size_t) want)) == want)
{
/* Keep track of how much written not counting additional \r's */
res = data - (char *)ptr;