summaryrefslogtreecommitdiffhomepage
path: root/fuzz-wrapfd.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-02-21 21:03:42 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-02-21 21:03:42 +0800
commitdbc052099291a313295170c67bb122d85f889be7 (patch)
tree2d21eba81aac2d4f3e751482a556057b500ab684 /fuzz-wrapfd.c
parentdcb41e91eb7ec97d8af0e9ad748345cdd1c1319e (diff)
compile fixes
--HG-- branch : fuzz
Diffstat (limited to 'fuzz-wrapfd.c')
-rw-r--r--fuzz-wrapfd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fuzz-wrapfd.c b/fuzz-wrapfd.c
index dde8dde..b4bcb72 100644
--- a/fuzz-wrapfd.c
+++ b/fuzz-wrapfd.c
@@ -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_setup() {
}
void wrapfd_setseed(uint32_t seed) {
- *((uint32_t*)rand_state) = seed;
+ memcpy(rand_state, &seed, sizeof(seed));
nrand48(rand_state);
}
@@ -77,12 +77,10 @@ void wrapfd_remove(int fd) {
}
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 @@ int wrapfd_select(int nfds, fd_set *readfds, fd_set *writefds,
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);