diff options
author | Stefan Beller <sbeller@google.com> | 2016-02-29 18:07:15 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-03-01 11:57:19 -0800 |
commit | 2dac9b5637abe580e8b8ea36e00dbbf28ec99af6 (patch) | |
tree | 57b46bdae2fad445c5d06538e7bae6b4de59f16c /strbuf.c | |
parent | 8c6b5491182510f2344dae71784fcb5c3992d005 (diff) | |
download | git-2dac9b5637abe580e8b8ea36e00dbbf28ec99af6.tar.gz |
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 <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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) |