From 13d05e6b74fae4e5097ce0649c81b5fb3a3d80e3 Mon Sep 17 00:00:00 2001 From: Lailouezzz Date: Wed, 1 Jan 2020 23:59:36 +0100 Subject: [PATCH] If read size = 0 errno is 0 --- lib/stream/read.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/stream/read.c b/lib/stream/read.c index 9c1028e..c49a9d8 100644 --- a/lib/stream/read.c +++ b/lib/stream/read.c @@ -36,8 +36,10 @@ size_t CASIO_EXPORT casio_read(casio_stream_t *stream, void *dest, size_t size) failure(~stream->casio_stream_mode & CASIO_OPENMODE_READ, casio_error_read) /* read */ - if (size == 0) return (0); - + if (size == 0) { + errno = err; + return (0); + } size = (*getcb(stream, read))(stream->casio_stream_cookie, dest, size); if (size == (size_t)-1) {