summaryrefslogtreecommitdiff
path: root/src/tools/oecho/oecho.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2020-03-14 17:52:06 +0100
committerSander Vrijders <[email protected]>2020-03-15 14:30:58 +0100
commit51d8f69fb152ae5a47151c2f132fd4263ec3d144 (patch)
tree67ef7b137bc00fdbb93774aa8ccbbbb39975ace0 /src/tools/oecho/oecho.c
parentb977090a7692acada4b81677e88c5a5e60a153c3 (diff)
downloadouroboros-55e2c62f01458b8a4104777c54c1394f18727b9b.tar.gz
ouroboros-55e2c62f01458b8a4104777c54c1394f18727b9b.zip
lib: Return number of written bytes on flow_write0.17.0
This is more in line with the write() system call and prepares for partial writes. Partial writes are disabled by default (and not yet implemented). Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/tools/oecho/oecho.c')
-rw-r--r--src/tools/oecho/oecho.c6
1 files changed, 3 insertions, 3 deletions
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) {