Show correct message ("Remote end closed connection") when we get EOF

on a socket.

I also added a wrapper function around strerror() for dgets_errno, since
we did the same thing in a few places.  This all needs to be cleaned up
a little - the -1 value we use could in theory clash with an actual
errno error number.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@104 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2010-09-30 13:26:06 +00:00
parent 7a59da1f2e
commit d1e13bc526
5 changed files with 22 additions and 5 deletions

View File

@@ -100,6 +100,20 @@ void SSL_show_errors(void)
}
#endif
/* Wrapper around strerror() for dgets_errno.
*/
const char *dgets_strerror(int dgets_errno)
{
switch (dgets_errno)
{
case -1:
return "Remote end closed connection";
default:
return strerror(dgets_errno);
}
}
/*
* All new dgets -- no more trap doors!
*
@@ -204,7 +218,7 @@ int BX_dgets (char *str, int des, int buffer, int buffersize, void *ssl_fd)
else if (!nbytes && ioe->write_pos == 0)
{
*str = 0;
dgets_errno = errno;
dgets_errno = -1;
return -1;
}