summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2010-12-26 15:00:36 +0000
committerArthur de Jong <arthur@arthurdejong.org>2010-12-26 15:00:36 +0000
commit1a379549c64ecbdb56c834e935223c991700da7d (patch)
treebfcaae6de6571484c600ffd38c4fe360a180cfe1 /common
parent57d61f2d89c1a8fd7e9341b7dd97cdb8a16b30d5 (diff)
return connection reset when connection was closed by the other end
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1344 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'common')
-rw-r--r--common/tio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/tio.c b/common/tio.c
index 0914a4a..468d5cb 100644
--- a/common/tio.c
+++ b/common/tio.c
@@ -295,7 +295,12 @@ int tio_read(TFILE *fp, void *buf, size_t count)
/* read the input in the buffer */
rv=read(fp->fd,fp->readbuffer.buffer+fp->readbuffer.start,fp->readbuffer.size-fp->readbuffer.start);
/* check for errors */
- if ((rv==0)||((rv<0)&&(errno!=EINTR)&&(errno!=EAGAIN)))
+ if (rv==0)
+ {
+ errno=ECONNRESET;
+ return -1;
+ }
+ else if ((rv<0)&&(errno!=EINTR)&&(errno!=EAGAIN))
return -1; /* something went wrong with the read */
/* skip the read part in the buffer */
fp->readbuffer.len=rv;