summaryrefslogtreecommitdiff
path: root/src/tools/obc/obc.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-03-14 17:52:06 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-03-15 14:30:58 +0100
commit51d8f69fb152ae5a47151c2f132fd4263ec3d144 (patch)
tree67ef7b137bc00fdbb93774aa8ccbbbb39975ace0 /src/tools/obc/obc.c
parentb977090a7692acada4b81677e88c5a5e60a153c3 (diff)
downloadouroboros-51d8f69fb152ae5a47151c2f132fd4263ec3d144.tar.gz
ouroboros-51d8f69fb152ae5a47151c2f132fd4263ec3d144.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 <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/tools/obc/obc.c')
-rw-r--r--src/tools/obc/obc.c5
1 files changed, 3 insertions, 2 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;