From 2dac9b5637abe580e8b8ea36e00dbbf28ec99af6 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Mon, 29 Feb 2016 18:07:15 -0800 Subject: run_processes_parallel: treat output of children as byte array We do not want the output to be interrupted by a NUL byte, so we cannot use raw fputs. Introduce strbuf_write to avoid having long arguments in run-command.c. Reviewed-by: Jonathan Nieder Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- strbuf.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'strbuf.c') diff --git a/strbuf.c b/strbuf.c index 38686ffb6..5f6da82e7 100644 --- a/strbuf.c +++ b/strbuf.c @@ -395,6 +395,12 @@ ssize_t strbuf_read_once(struct strbuf *sb, int fd, size_t hint) return cnt; } +ssize_t strbuf_write(struct strbuf *sb, FILE *f) +{ + return sb->len ? fwrite(sb->buf, 1, sb->len, f) : 0; +} + + #define STRBUF_MAXLINK (2*PATH_MAX) int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint) -- cgit v1.2.1