From c678d52fd37af208a17f19628790840f0d3be366 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 28 Aug 2017 23:25:37 +0200 Subject: [PATCH] fixup! test-helper: learn to act as a drop-in replacement for `iconv` --- t/helper/test-helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/t/helper/test-helper.c b/t/helper/test-helper.c index 6ab466a700..c3b4e0bf93 100644 --- a/t/helper/test-helper.c +++ b/t/helper/test-helper.c @@ -51,7 +51,7 @@ static int iconv_(int argc, const char **argv) { struct strbuf buf = STRBUF_INIT; char *from = NULL, *to = NULL, *p; - int len, ret; + int len, ret = 0; const char * const iconv_usage[] = { N_("test-helper --iconv []"), NULL @@ -77,7 +77,8 @@ static int iconv_(int argc, const char **argv) p = reencode_string_len(buf.buf, buf.len, to, from, &len); if (!p) die_errno("Could not reencode"); - ret = write(1, p, len); + if (write(1, p, len) < 0) + ret = !!error_errno("Could not write %d bytes", len); strbuf_release(&buf); free(p);