fixup! test-helper: learn to act as a drop-in replacement for iconv

This commit is contained in:
Johannes Schindelin
2017-08-28 23:25:37 +02:00
parent 0cb6d35d23
commit c678d52fd3

View File

@@ -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 [<options>]"),
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);