diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2020-03-14 17:52:06 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2020-03-15 14:30:58 +0100 |
commit | 51d8f69fb152ae5a47151c2f132fd4263ec3d144 (patch) | |
tree | 67ef7b137bc00fdbb93774aa8ccbbbb39975ace0 /src/lib/dev.c | |
parent | b977090a7692acada4b81677e88c5a5e60a153c3 (diff) | |
download | ouroboros-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/lib/dev.c')
-rw-r--r-- | src/lib/dev.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index 8647bea9..80d7e9ad 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -1007,6 +1007,7 @@ ssize_t flow_write(int fd, if ((flags & FLOWFACCMODE) == FLOWFRDONLY) return -EPERM; + /* TODO: partial writes. */ if (flags & FLOWFWNOBLOCK) idx = shm_rdrbuff_alloc(ai.rdrb, count, @@ -1056,9 +1057,7 @@ ssize_t flow_write(int fd, pthread_rwlock_unlock(&ai.lock); - assert(ret <= 0); - - return ret; + return ret < 0 ? (ssize_t) ret : (ssize_t) count; } ssize_t flow_read(int fd, |