X-Git-Url: http://git.thejh.net/?p=libjh.git;a=blobdiff_plain;f=io.c;h=17ea4d675b04fc709e18738a3e2ec0faf5a47130;hp=2173478513a88ae9e6e3ad8726963311d39222bf;hb=68baa08af4f48a619aaac76de0010c68cd2fe1e4;hpb=9e73c19b7eb834507b9e62cb84b07ca53ad7a914 diff --git a/io.c b/io.c index 2173478..17ea4d6 100644 --- a/io.c +++ b/io.c @@ -1,5 +1,4 @@ // Copyright (2013) Jann Horn -// This code is licensed under the AGPLv3. HEADER #include #include @@ -43,7 +42,8 @@ PUBLIC_FN ssize_t read_nointr(int fd, void *buf, size_t count, int *last_res) { // - -1: error // - 0: stream ended // - 1: no problems occured -PUBLIC_FN ssize_t write_nointr(int fd, void *buf, size_t count, int *last_res) { +PUBLIC_FN ssize_t write_nointr(int fd, void *buf, ssize_t count, int *last_res) { + if (count == -1) count = strlen(buf); errno = 0; size_t done = 0; while (done < count) {