mirror of
https://repo.or.cz/socat.git
synced 2025-06-18 23:06:51 +00:00
Fixed: xiopoll(...) Bad file descriptor
This commit is contained in:
parent
1154e69d3e
commit
9beffd3193
2 changed files with 12 additions and 7 deletions
4
CHANGES
4
CHANGES
|
@ -25,6 +25,10 @@ Corrections:
|
||||||
Partial write situations respect total inactivity timeout when
|
Partial write situations respect total inactivity timeout when
|
||||||
nonblocking.
|
nonblocking.
|
||||||
|
|
||||||
|
Fixed a bug that could lead to error "xiopoll(...): Bad file descriptor"
|
||||||
|
or to undefined behaviour before terminating Socat with addresses EXEC,
|
||||||
|
SYSTEM, or SHELL.
|
||||||
|
|
||||||
Building:
|
Building:
|
||||||
Disabling certain features during configure could break build process.
|
Disabling certain features during configure could break build process.
|
||||||
|
|
||||||
|
|
15
socat.c
15
socat.c
|
@ -865,11 +865,12 @@ int childleftdata(xiofile_t *xfd) {
|
||||||
XIO_RDSTREAM(xfd)->para.exec.pid == 0) {
|
XIO_RDSTREAM(xfd)->para.exec.pid == 0) {
|
||||||
struct timeval timeout = { 0, 0 };
|
struct timeval timeout = { 0, 0 };
|
||||||
|
|
||||||
if (XIO_READABLE(xfd) && !(XIO_RDSTREAM(xfd)->eof >= 2 && !XIO_RDSTREAM(xfd)->ignoreeof)) {
|
if (XIO_RDSTREAM(xfd)->eof >= 2 && !XIO_RDSTREAM(xfd)->ignoreeof)
|
||||||
in.fd = XIO_GETRDFD(xfd);
|
return 0;
|
||||||
in.events = POLLIN/*|POLLRDBAND*/;
|
|
||||||
in.revents = 0;
|
in.fd = XIO_GETRDFD(xfd);
|
||||||
}
|
in.events = POLLIN/*|POLLRDBAND*/;
|
||||||
|
in.revents = 0;
|
||||||
do {
|
do {
|
||||||
int _errno;
|
int _errno;
|
||||||
retval = xiopoll(&in, 1, &timeout);
|
retval = xiopoll(&in, 1, &timeout);
|
||||||
|
@ -877,7 +878,7 @@ int childleftdata(xiofile_t *xfd) {
|
||||||
} while (retval < 0 && errno == EINTR);
|
} while (retval < 0 && errno == EINTR);
|
||||||
|
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
Error5("xiopoll({%d,%0o}, 1, {"F_tv_sec"."F_tv_usec"}): %s",
|
Error5("xiopoll({%d,0%o}, 1, {"F_tv_sec"."F_tv_usec"}): %s",
|
||||||
in.fd, in.events, timeout.tv_sec, timeout.tv_usec,
|
in.fd, in.events, timeout.tv_sec, timeout.tv_usec,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1133,7 +1134,7 @@ int _socat(void) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
Error11("xiopoll({%d,%0o}{%d,%0o}{%d,%0o}{%d,%0o}, 4, {"F_tv_sec"."F_tv_usec"}): %s",
|
Error11("xiopoll({%d,0%o}{%d,0%o}{%d,0%o}{%d,0%o}, 4, {"F_tv_sec"."F_tv_usec"}): %s",
|
||||||
fds[0].fd, fds[0].events, fds[1].fd, fds[1].events,
|
fds[0].fd, fds[0].events, fds[1].fd, fds[1].events,
|
||||||
fds[2].fd, fds[2].events, fds[3].fd, fds[3].events,
|
fds[2].fd, fds[2].events, fds[3].fd, fds[3].events,
|
||||||
timeout.tv_sec, timeout.tv_usec, strerror(errno));
|
timeout.tv_sec, timeout.tv_usec, strerror(errno));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue