# HG changeset patch # User Matt Johnston # Date 1519218222 -28800 # Node ID b9e4fd5a0e72cc499b16d12c63d7b8b1b0909bee # Parent b024f96957826d3cf176e8b32d8eb779c0241c77 compile fixes diff -r b024f9695782 -r b9e4fd5a0e72 fuzz-wrapfd.c --- a/fuzz-wrapfd.c Sat Feb 17 19:41:44 2018 +0800 +++ b/fuzz-wrapfd.c Wed Feb 21 21:03:42 2018 +0800 @@ -4,7 +4,7 @@ #include "fuzz.h" -static const int IOWRAP_MAXFD = FD_SETSIZE-1; +#define IOWRAP_MAXFD (FD_SETSIZE-1) static const int MAX_RANDOM_IN = 50000; static const double CHANCE_CLOSE = 1.0 / 300; static const double CHANCE_INTR = 1.0 / 200; @@ -37,7 +37,7 @@ } void wrapfd_setseed(uint32_t seed) { - *((uint32_t*)rand_state) = seed; + memcpy(rand_state, &seed, sizeof(seed)); nrand48(rand_state); } @@ -77,12 +77,10 @@ } int wrapfd_close(int fd) { - if (fd >= 0 && fd <= IOWRAP_MAXFD && wrap_fds[fd].mode != UNUSED) - { + if (fd >= 0 && fd <= IOWRAP_MAXFD && wrap_fds[fd].mode != UNUSED) { wrapfd_remove(fd); return 0; - } - else { + } else { return close(fd); } } @@ -173,7 +171,9 @@ fd_set *exceptfds, struct timeval *timeout) { int i, nset, sel; int ret = 0; - int fdlist[IOWRAP_MAXFD+1] = {0}; + int fdlist[IOWRAP_MAXFD+1]; + + memset(fdlist, 0x0, sizeof(fdlist)); if (!fuzz.wrapfds) { return select(nfds, readfds, writefds, exceptfds, timeout);