aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-16 08:19:39 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-16 08:19:39 +0200
commit3be131280d0f2c7f834b54cee5346918ab8b2aac (patch)
tree4d8e00dbc98b0bb903a984d50d38b28216a092ee /tcp.c
parentd4815788820df171b6b5bfcaea4f9ff65a9a8b3d (diff)
downloadpasst-3be131280d0f2c7f834b54cee5346918ab8b2aac.tar
passt-3be131280d0f2c7f834b54cee5346918ab8b2aac.tar.gz
passt-3be131280d0f2c7f834b54cee5346918ab8b2aac.tar.bz2
passt-3be131280d0f2c7f834b54cee5346918ab8b2aac.tar.lz
passt-3be131280d0f2c7f834b54cee5346918ab8b2aac.tar.xz
passt-3be131280d0f2c7f834b54cee5346918ab8b2aac.tar.zst
passt-3be131280d0f2c7f834b54cee5346918ab8b2aac.zip
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>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tcp.c b/tcp.c
index cc36ac3..80458e3 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1583,11 +1583,15 @@ static void tcp_splice_destroy(struct ctx *c, struct tcp_splice_conn *conn)
case SPLICE_ESTABLISHED:
if (conn->pipe_from_to[0] != -1) {
close(conn->pipe_from_to[0]);
+ conn->pipe_from_to[0] = -1;
close(conn->pipe_from_to[1]);
+ conn->pipe_from_to[1] = -1;
}
if (conn->pipe_to_from[0] != -1) {
close(conn->pipe_to_from[0]);
+ conn->pipe_to_from[0] = -1;
close(conn->pipe_to_from[1]);
+ conn->pipe_to_from[1] = -1;
}
/* Falls through */
case SPLICE_CONNECT: