1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-16 16:13:24 +00:00

ECONNRESET,EPIPE on read() and shutdown() are now errors

This commit is contained in:
Gerhard Rieger 2023-06-18 15:58:24 +02:00
parent 1861303728
commit fe4444a70b
4 changed files with 37 additions and 16 deletions

View file

@ -52,9 +52,22 @@ int xioshutdown(xiofile_t *sock, int how) {
}
return 0;
case XIOSHUT_DOWN:
if ((result = Shutdown(sock->stream.fd, how)) < 0) {
Info3("shutdown(%d, %d): %s",
sock->stream.fd, how, strerror(errno));
result = Shutdown(sock->stream.fd, how);
if (result < 0) {
int level, _errno = errno;
switch (_errno) {
case EPIPE:
case ECONNRESET:
level = E_ERROR;
break;
default:
level = E_INFO; /* old behaviour */
break;
}
Msg3(level, "shutdown(%d, %d): %s",
sock->stream.fd, how, strerror(_errno));
errno = _errno;
return -1;
}
return 0;
#if _WITH_SOCKET