comparison fuzz-wrapfd.c @ 1596:60fceff95858

workaround memory sanitizer FD_ZERO false positives
author Matt Johnston <matt@ucc.asn.au>
date Tue, 06 Mar 2018 21:51:51 +0800
parents b579ec254988
children dfbe947bdf0d
comparison
equal deleted inserted replaced
1595:4fe7cc9e45eb 1596:60fceff95858
1 #define FUZZ_SKIP_WRAP 1 1 #define FUZZ_SKIP_WRAP 1
2 #include "includes.h" 2 #include "includes.h"
3 #include "fuzz-wrapfd.h" 3 #include "fuzz-wrapfd.h"
4
5 #include "dbutil.h"
4 6
5 #include "fuzz.h" 7 #include "fuzz.h"
6 8
7 #define IOWRAP_MAXFD (FD_SETSIZE-1) 9 #define IOWRAP_MAXFD (FD_SETSIZE-1)
8 static const int MAX_RANDOM_IN = 50000; 10 static const int MAX_RANDOM_IN = 50000;
193 assert(wrap_fds[i].mode != UNUSED); 195 assert(wrap_fds[i].mode != UNUSED);
194 fdlist[nset] = i; 196 fdlist[nset] = i;
195 nset++; 197 nset++;
196 } 198 }
197 } 199 }
198 FD_ZERO(readfds); 200 DROPBEAR_FD_ZERO(readfds);
199 201
200 if (nset > 0) { 202 if (nset > 0) {
201 /* set one */ 203 /* set one */
202 sel = fdlist[nrand48(rand_state) % nset]; 204 sel = fdlist[nrand48(rand_state) % nset];
203 FD_SET(sel, readfds); 205 FD_SET(sel, readfds);
220 assert(wrap_fds[i].mode != UNUSED); 222 assert(wrap_fds[i].mode != UNUSED);
221 fdlist[nset] = i; 223 fdlist[nset] = i;
222 nset++; 224 nset++;
223 } 225 }
224 } 226 }
225 FD_ZERO(writefds); 227 DROPBEAR_FD_ZERO(writefds);
226 228
227 /* set one */ 229 /* set one */
228 if (nset > 0) { 230 if (nset > 0) {
229 sel = fdlist[nrand48(rand_state) % nset]; 231 sel = fdlist[nrand48(rand_state) % nset];
230 FD_SET(sel, writefds); 232 FD_SET(sel, writefds);