diff fuzz-wrapfd.c @ 1360:16f45f2df38f fuzz

ignore wrapfd_close for unknown
author Matt Johnston <matt@ucc.asn.au>
date Sun, 21 May 2017 10:48:18 +0800
parents 6b89eb92f872
children d4cc85e6c569
line wrap: on
line diff
--- a/fuzz-wrapfd.c	Sat May 20 23:39:01 2017 +0800
+++ b/fuzz-wrapfd.c	Sun May 21 10:48:18 2017 +0800
@@ -44,7 +44,6 @@
 	assert(wrap_fds[fd].mode == UNUSED);
 	assert(buf || mode == RANDOMIN);
 
-
 	wrap_fds[fd].mode = mode;
 	wrap_fds[fd].buf = buf;
 	wrap_fds[fd].closein = 0;
@@ -73,8 +72,15 @@
 	nused--;
 }
 
-void wrapfd_close(int fd) {
-	wrapfd_remove(fd);
+int wrapfd_close(int fd) {
+	if (fd >= 0 && fd <= IOWRAP_MAXFD && wrap_fds[fd].mode != UNUSED) 
+	{
+		wrapfd_remove(fd);
+		return 0;
+	}
+	else {
+		return close(fd);
+	}
 }
 
 int wrapfd_read(int fd, void *out, size_t count) {