summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/iperf/files/iperf-fix-bandwidth-limit.patch')
-rw-r--r--net-misc/iperf/files/iperf-fix-bandwidth-limit.patch21
1 files changed, 21 insertions, 0 deletions
diff --git a/net-misc/iperf/files/iperf-fix-bandwidth-limit.patch b/net-misc/iperf/files/iperf-fix-bandwidth-limit.patch
new file mode 100644
index 000000000000..eb9df8cd31b3
--- /dev/null
+++ b/net-misc/iperf/files/iperf-fix-bandwidth-limit.patch
@@ -0,0 +1,21 @@
+
+2011-10-14 Israel G. Lugo <israel.lugo@lugosys.com>
+
+* Fix delay_loop() for delays of 1s and greater. Was causing breakage when a
+low bandwidth limit was specified.
+
+
+--- a/compat/delay.cpp
++++ b/compat/delay.cpp
+@@ -63,8 +63,9 @@ void delay_loop(unsigned long usec)
+ {
+ struct timespec requested, remaining;
+
+- requested.tv_sec = 0;
+- requested.tv_nsec = usec * 1000L;
++ /* convert to seconds; nanosleep requires 0 <= tv_nsec <= 999999999 */
++ requested.tv_sec = usec / 1000000UL;
++ requested.tv_nsec = (usec % 1000000UL) * 1000UL;
+
+ while (nanosleep(&requested, &remaining) == -1)
+ if (errno == EINTR)