chiark
/
gitweb
/
~ian
/
secnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
test: udp-preload: Cope with -ve fds
[secnet.git]
/
test
/
udp-preload.c
diff --git
a/test/udp-preload.c
b/test/udp-preload.c
index 94b399a1e7c1a0412a120b101975ff433cc7ad87..b4c0879be1836a63788122f2e7897366eb8281f4 100644
(file)
--- 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<tablesz) {
+ if (fd
>=0 && fd
<tablesz) {
free(table[fd]);
table[fd]=0;
}