aboutsummaryrefslogtreecommitdiff
path: root/src/iperf_util.c
diff options
context:
space:
mode:
authorJef Poskanzer <jef@mail.acme.com>2013-11-06 11:05:46 -0800
committerJef Poskanzer <jef@mail.acme.com>2013-11-06 11:05:46 -0800
commit4e2ef5070b963230815dd938313517bba2042427 (patch)
tree9e47d40228ae5b895cd5904bddf2fb169e08b84a /src/iperf_util.c
parent2944aaa05b94779aa5ecf50d49aaa02c2796107a (diff)
downloadiperf3-4e2ef5070b963230815dd938313517bba2042427.tar.gz
More sizeof changes.
A couple more sizeof issues found and fixed. One of them is actually another protocol change, but due to a fortuitous accident it should remain compatible with older versions. Detailed explanation: When a client attempts to connect to a server that is already busy, the server is supposed to return ACCESS_DENIED as a state value. It was doing so, but was writing it as an int, even though state values are supposed to be signed chars. The client read the value correctly as a signed char, getting one byte and throwing away the rest. So why did this ever work? Because ACCESS_DENIED is the value -1, and any byte of an int -1 equals a signed char -1. If ACCESS_DENIED had been any other value, this would have been an opvious bug and would have long since been fixed. As is, it stuck around working by accident until now.
Diffstat (limited to 'src/iperf_util.c')
-rw-r--r--src/iperf_util.c2
1 files changed, 1 insertions, 1 deletions
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;