mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
Fixed hanging of OpenSSL due to nested xioclose()
This commit is contained in:
parent
d16f1fe125
commit
fdddba24b8
2 changed files with 12 additions and 2 deletions
3
CHANGES
3
CHANGES
|
@ -4,6 +4,9 @@ Corrections:
|
||||||
Thanks to Kush Upadhyay from Amazon Bottlerocket team for providing the
|
Thanks to Kush Upadhyay from Amazon Bottlerocket team for providing the
|
||||||
patch.
|
patch.
|
||||||
|
|
||||||
|
In some situations xioclose() was called nested what could cause hanging
|
||||||
|
of OpenSSL in pthread_rwlock_wrlock()
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
Total inactivity timeout option -T 0 now means 0.0 seconds; up to
|
Total inactivity timeout option -T 0 now means 0.0 seconds; up to
|
||||||
version 1.8.0.0 it meant no total inactivity timeout.
|
version 1.8.0.0 it meant no total inactivity timeout.
|
||||||
|
|
11
xioclose.c
11
xioclose.c
|
@ -23,6 +23,11 @@ int xioclose1(struct single *pipe) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pipe->tag == XIO_TAG_CLOSED) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pipe->tag |= XIO_TAG_CLOSED;
|
||||||
|
|
||||||
#if WITH_READLINE
|
#if WITH_READLINE
|
||||||
if ((pipe->dtype & XIODATA_MASK) == XIODATA_READLINE) {
|
if ((pipe->dtype & XIODATA_MASK) == XIODATA_READLINE) {
|
||||||
Write_history(pipe->para.readline.history_file);
|
Write_history(pipe->para.readline.history_file);
|
||||||
|
@ -112,7 +117,6 @@ int xioclose1(struct single *pipe) {
|
||||||
free(pipe->unlink_close);
|
free(pipe->unlink_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe->tag |= XIO_TAG_CLOSED;
|
|
||||||
return 0; /*! */
|
return 0; /*! */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,11 +130,14 @@ int xioclose(xiofile_t *file) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (file->tag == XIO_TAG_CLOSED) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (file->tag == XIO_TAG_DUAL) {
|
if (file->tag == XIO_TAG_DUAL) {
|
||||||
|
file->tag |= XIO_TAG_CLOSED;
|
||||||
result = xioclose1(file->dual.stream[0]);
|
result = xioclose1(file->dual.stream[0]);
|
||||||
result |= xioclose1(file->dual.stream[1]);
|
result |= xioclose1(file->dual.stream[1]);
|
||||||
file->tag |= XIO_TAG_CLOSED;
|
|
||||||
} else {
|
} else {
|
||||||
result = xioclose1(&file->stream);
|
result = xioclose1(&file->stream);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue