diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 075c7dc..f76a2a8 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -110,7 +110,7 @@ int iperf_accept(struct iperf_test *test) { int s; - int rbuf = ACCESS_DENIED; + signed char rbuf = ACCESS_DENIED; char cookie[COOKIE_SIZE]; socklen_t len; struct sockaddr_storage addr; @@ -148,7 +148,7 @@ iperf_accept(struct iperf_test *test) i_errno = IERECVCOOKIE; return -1; } - if (Nwrite(s, (char*) &rbuf, sizeof(int), Ptcp) < 0) { + if (Nwrite(s, (char*) &rbuf, sizeof(rbuf), Ptcp) < 0) { i_errno = IESENDMESSAGE; return -1; } diff --git a/src/iperf_tcp.c b/src/iperf_tcp.c index 1bbc248..e80b53e 100644 --- a/src/iperf_tcp.c +++ b/src/iperf_tcp.c @@ -96,7 +96,7 @@ iperf_tcp_accept(struct iperf_test * test) } if (strcmp(test->cookie, cookie) != 0) { - if (Nwrite(s, (char*) &rbuf, sizeof(signed char), Ptcp) < 0) { + if (Nwrite(s, (char*) &rbuf, sizeof(rbuf), Ptcp) < 0) { i_errno = IESENDMESSAGE; return -1; } diff --git a/src/iperf_util.c b/src/iperf_util.c index 5393c5f..1b25dd6 100644 --- a/src/iperf_util.c +++ b/src/iperf_util.c @@ -136,7 +136,7 @@ delay(int64_t ns) while (nanosleep(&req, &rem) == -1) if (EINTR == errno) - memcpy(&req, &rem, sizeof rem); + memcpy(&req, &rem, sizeof(rem)); else return -1; return 0; diff --git a/src/tcp_window_size.c b/src/tcp_window_size.c index 279c178..59819d0 100644 --- a/src/tcp_window_size.c +++ b/src/tcp_window_size.c @@ -90,7 +90,7 @@ set_tcp_windowsize(int sock, int bufsize, int dir) */ // printf("Setting TCP buffer to size: %d\n", bufsize); newbufsize = bufsize; - rc = setsockopt(sock, SOL_SOCKET, dir, (char *) &newbufsize, sizeof newbufsize); + rc = setsockopt(sock, SOL_SOCKET, dir, (char *) &newbufsize, sizeof(newbufsize)); if (rc < 0) return rc; } else {