summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/obc/obc.c5
-rw-r--r--src/tools/ocbr/ocbr_client.c2
-rw-r--r--src/tools/oecho/oecho.c6
-rw-r--r--src/tools/operf/operf_client.c4
-rw-r--r--src/tools/oping/oping_client.c2
-rw-r--r--src/tools/ovpn/ovpn.c2
6 files changed, 11 insertions, 10 deletions
diff --git a/src/tools/obc/obc.c b/src/tools/obc/obc.c
index eb5a42ce..256cb84e 100644
--- a/src/tools/obc/obc.c
+++ b/src/tools/obc/obc.c
@@ -88,7 +88,8 @@ static int reader_main(const char * dst)
static int writer_main(const char * dst,
const char * message)
{
- int fd = 0;
+ int fd = 0;
+ size_t len = strlen(message) + 1;
fd = flow_join(dst, NULL, NULL);
if (fd < 0) {
@@ -96,7 +97,7 @@ static int writer_main(const char * dst,
return -1;
}
- if (flow_write(fd, message, strlen(message) + 1) < 0) {
+ if (flow_write(fd, message, len) < 0) {
printf("Failed to write packet.\n");
flow_dealloc(fd);
return -1;
diff --git a/src/tools/ocbr/ocbr_client.c b/src/tools/ocbr/ocbr_client.c
index 6381a235..6120e1fd 100644
--- a/src/tools/ocbr/ocbr_client.c
+++ b/src/tools/ocbr/ocbr_client.c
@@ -135,7 +135,7 @@ int client_main(char * server,
} else { /* flood */
while (!stop) {
clock_gettime(CLOCK_REALTIME, &end);
- if (flow_write(fd, buf, (size_t) size) < 0) {
+ if (flow_write(fd, buf, size) < 0) {
stop = true;
continue;
}
diff --git a/src/tools/oecho/oecho.c b/src/tools/oecho/oecho.c
index f52f53de..a44b8b76 100644
--- a/src/tools/oecho/oecho.c
+++ b/src/tools/oecho/oecho.c
@@ -79,7 +79,7 @@ static int server_main(void)
printf("Message from client is %.*s.\n", (int) count, buf);
- if (flow_write(fd, buf, count) == -1) {
+ if (flow_write(fd, buf, count) < 0) {
printf("Failed to write packet.\n");
flow_dealloc(fd);
continue;
@@ -93,10 +93,10 @@ static int server_main(void)
static int client_main(void)
{
- int fd = 0;
+ int fd;
char buf[BUF_SIZE];
char * message = "Client says hi!";
- ssize_t count = 0;
+ ssize_t count;
fd = flow_alloc("oecho", NULL, NULL);
if (fd < 0) {
diff --git a/src/tools/operf/operf_client.c b/src/tools/operf/operf_client.c
index 3b0ff2af..004a8965 100644
--- a/src/tools/operf/operf_client.c
+++ b/src/tools/operf/operf_client.c
@@ -141,7 +141,7 @@ void * writer(void * o)
msg->id = client.sent;
- if (flow_write(*fdp, buf, client.size) == -1) {
+ if (flow_write(*fdp, buf, client.size) < 0) {
printf("Failed to send packet.\n");
flow_dealloc(*fdp);
free(buf);
@@ -204,7 +204,7 @@ int client_main(void)
else
printf("Doing a unidirectional test.\n");
- if (flow_write(fd, &client.conf, sizeof(client.conf))) {
+ if (flow_write(fd, &client.conf, sizeof(client.conf)) < 0) {
printf("Failed to send configuration.\n");
flow_dealloc(fd);
return -1;
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index aa92be53..d0255b7c 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -175,7 +175,7 @@ void * writer(void * o)
msg->tv_sec = now.tv_sec;
msg->tv_nsec = now.tv_nsec;
- if (flow_write(*fdp, buf, client.size) == -1) {
+ if (flow_write(*fdp, buf, client.size) < 0) {
printf("Failed to send packet.\n");
flow_dealloc(*fdp);
free(buf);
diff --git a/src/tools/ovpn/ovpn.c b/src/tools/ovpn/ovpn.c
index a3dd2ec6..02501d52 100644
--- a/src/tools/ovpn/ovpn.c
+++ b/src/tools/ovpn/ovpn.c
@@ -163,7 +163,7 @@ void * t_reader(void * o)
if (len <= 0)
continue;
- if (flow_write(o_fd, buf, len))
+ if (flow_write(o_fd, buf, len) < 0)
continue;
}
}