summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-05-22 00:40:25 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-05-22 00:40:25 +0000
commitdb3fcdc5153e89db328244576cb339df9734ada2 (patch)
treefc0819d067580374ef5c8b74ad3f60b2861a5a5a /src
parente83b1d8245b7ca716bd6896c5a2725de7d7e9141 (diff)
downloadskalibs-db3fcdc5153e89db328244576cb339df9734ada2.tar.xz
Fix openreadnclose failing if errno was nonzero before (thanks jjk)
Diffstat (limited to 'src')
-rw-r--r--src/libstddjb/openreadnclose.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstddjb/openreadnclose.c b/src/libstddjb/openreadnclose.c
index aa61ece..57a9bdc 100644
--- 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 ;