From 40f0f4a07f08b301d9ed90c6b99659dfc795e371 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 12 Oct 2019 20:40:06 +0100 Subject: [PATCH] test: udp-preload: Cope with -ve fds Eg, Tcl passes -1 to close (!) #0 0x00007f62949883ca in close (fd=-1) at udp-preload.c:207 #1 0x00007f6294719362 in Tcl_FinalizeNotifier () from /usr/lib/x86_64-linux-gnu/libtcl8.6.so Signed-off-by: Ian Jackson --- test/udp-preload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/udp-preload.c b/test/udp-preload.c index 94b399a..b4c0879 100644 --- a/test/udp-preload.c +++ b/test/udp-preload.c @@ -96,7 +96,7 @@ static fdinfo **table; static int tablesz; static fdinfo *lookup(int fd) { - if (fd>=tablesz) return 0; + if (fd<0 || fd>=tablesz) return 0; return table[fd]; } @@ -203,7 +203,7 @@ WRAP(socket) { } WRAP(close) { - if (fd=0 && fd