From 51d8f69fb152ae5a47151c2f132fd4263ec3d144 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sat, 14 Mar 2020 17:52:06 +0100 Subject: lib: Return number of written bytes on flow_write 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 Signed-off-by: Sander Vrijders --- src/tools/oecho/oecho.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/tools/oecho/oecho.c') 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) { -- cgit v1.2.3