commit db3fcdc5153e89db328244576cb339df9734ada2
parent e83b1d8245b7ca716bd6896c5a2725de7d7e9141
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Mon, 22 May 2017 00:40:25 +0000
Fix openreadnclose failing if errno was nonzero before (thanks jjk)
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libstddjb/openreadnclose.c b/src/libstddjb/openreadnclose.c
@@ -7,7 +7,9 @@
static ssize_t readnclose (int fd, char *s, size_t n)
{
- size_t r = allread(fd, s, n) ;
+ size_t r ;
+ errno = 0 ;
+ r = allread(fd, s, n) ;
if (errno)
{
int e = errno ;