1
0
mirror of https://passt.top/passt synced 2024-12-22 21:55:22 +00:00

pasta, tcp: Set pipe descriptor numbers to -1 after closing

...so that we don't try to close them again, even if harmless.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-09-16 08:19:39 +02:00
parent d481578882
commit 3be131280d

4
tcp.c
View File

@ -1583,11 +1583,15 @@ static void tcp_splice_destroy(struct ctx *c, struct tcp_splice_conn *conn)
case SPLICE_ESTABLISHED: case SPLICE_ESTABLISHED:
if (conn->pipe_from_to[0] != -1) { if (conn->pipe_from_to[0] != -1) {
close(conn->pipe_from_to[0]); close(conn->pipe_from_to[0]);
conn->pipe_from_to[0] = -1;
close(conn->pipe_from_to[1]); close(conn->pipe_from_to[1]);
conn->pipe_from_to[1] = -1;
} }
if (conn->pipe_to_from[0] != -1) { if (conn->pipe_to_from[0] != -1) {
close(conn->pipe_to_from[0]); close(conn->pipe_to_from[0]);
conn->pipe_to_from[0] = -1;
close(conn->pipe_to_from[1]); close(conn->pipe_to_from[1]);
conn->pipe_to_from[1] = -1;
} }
/* Falls through */ /* Falls through */
case SPLICE_CONNECT: case SPLICE_CONNECT: