From: Ian Jackson Date: Sat, 12 Oct 2019 19:40:06 +0000 (+0100) Subject: test: udp-preload: Cope with -ve fds X-Git-Tag: v0.5.0~103 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=commitdiff_plain;h=40f0f4a07f08b301d9ed90c6b99659dfc795e371 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 --- 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