[4.1] ae4449e Add a couple of asserts for Coverity
    Lasse Karstensen 
    lkarsten at varnish-software.com
       
    Thu Jan 14 15:15:12 CET 2016
    
    
  
commit ae4449ee60cca489d4641b40c083952e98c4a5ab
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Jan 8 09:37:15 2016 +0000
    Add a couple of asserts for Coverity
diff --git a/lib/libvarnish/vsub.c b/lib/libvarnish/vsub.c
index a7c658c..dd0cb9d 100644
--- a/lib/libvarnish/vsub.c
+++ b/lib/libvarnish/vsub.c
@@ -56,10 +56,14 @@ struct vsub_priv {
 void
 VSUB_closefrom(int fd)
 {
+
+	assert(fd >= 0);
+
 #ifdef HAVE_CLOSEFROM
 	closefrom(fd);
 #else
-	int i;
+	int i = sysconf(_SC_OPEN_MAX);
+	assert(i > 0);
 	for (i = sysconf(_SC_OPEN_MAX); i > fd; i--)
 		(void)close(i);
 #endif
    
    
More information about the varnish-commit
mailing list