aboutsummaryrefslogtreecommitdiff
path: root/src/iperf_util.c
diff options
context:
space:
mode:
authorJef Poskanzer <jef@mail.acme.com>2013-12-05 08:49:27 -0800
committerJef Poskanzer <jef@mail.acme.com>2013-12-05 08:49:27 -0800
commita4c1383a7765f0df19adfb74d1ce20079e5f32e4 (patch)
treea23191167e73f972f4093e896c6339874f5d0c18 /src/iperf_util.c
parente42991a717ad35c2c4d2b406811c3c1b3617bcb3 (diff)
downloadiperf3-a4c1383a7765f0df19adfb74d1ce20079e5f32e4.tar.gz
Fixed bug where -R mode selected on a closed file.
Also added a debugging routine to dump an fd_set.
Diffstat (limited to 'src/iperf_util.c')
-rw-r--r--src/iperf_util.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/iperf_util.c b/src/iperf_util.c
index 4ac55e9..93c6cb1 100644
--- a/src/iperf_util.c
+++ b/src/iperf_util.c
@@ -279,3 +279,23 @@ iperf_json_printf(const char *format, ...)
va_end(argp);
return o;
}
+
+/* Debugging routine to dump out an fd_set. */
+void
+iperf_dump_fdset(FILE *fp, char *str, int nfds, fd_set *fds)
+{
+ int fd;
+ int comma;
+
+ fprintf(fp, "%s: [", str);
+ comma = 0;
+ for (fd = 0; fd < nfds; ++fd) {
+ if (FD_ISSET(fd, fds)) {
+ if (comma)
+ fprintf(fp, ", ");
+ fprintf(fp, "%d", fd);
+ comma = 1;
+ }
+ }
+ fprintf(fp, "]\n");
+}