From: Jann Horn Date: Tue, 5 Nov 2013 19:13:11 +0000 (+0100) Subject: io: write_nointr should treat count -1 as "just do strlen on the buffer" X-Git-Url: http://git.thejh.net/?p=libjh.git;a=commitdiff_plain;h=68baa08af4f48a619aaac76de0010c68cd2fe1e4 io: write_nointr should treat count -1 as "just do strlen on the buffer" --- diff --git a/io.c b/io.c index dd0d531..17ea4d6 100644 --- a/io.c +++ b/io.c @@ -42,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) {