From 68baa08af4f48a619aaac76de0010c68cd2fe1e4 Mon Sep 17 00:00:00 2001 From: Jann Horn Date: Tue, 5 Nov 2013 20:13:11 +0100 Subject: [PATCH] io: write_nointr should treat count -1 as "just do strlen on the buffer" --- io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- 2.20.1