summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-03-31 22:14:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-31 22:14:27 (GMT)
commit890a13a45285ad44858add2ce2f74eb478f549c8 (patch)
tree778d3d73aef0d238edd621eaaf38dcdb9f22616e /diff.c
parent87b3c0117a340df61bdbac6794611c74696bd42a (diff)
parent2be10bb5c1cfe15aa4f1b43137ccd17d826d8553 (diff)
downloadgit-890a13a45285ad44858add2ce2f74eb478f549c8.zip
git-890a13a45285ad44858add2ce2f74eb478f549c8.tar.gz
git-890a13a45285ad44858add2ce2f74eb478f549c8.tar.bz2
Sync with 1.7.0.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/diff.c b/diff.c
index f5d93e9..2daa732 100644
--- a/diff.c
+++ b/diff.c
@@ -3883,6 +3883,7 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
const char **arg = argv;
struct child_process child;
struct strbuf buf = STRBUF_INIT;
+ int err = 0;
temp = prepare_temp_file(spec->path, spec);
*arg++ = pgm;
@@ -3893,16 +3894,20 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
child.use_shell = 1;
child.argv = argv;
child.out = -1;
- if (start_command(&child) != 0 ||
- strbuf_read(&buf, child.out, 0) < 0 ||
- finish_command(&child) != 0) {
- close(child.out);
- strbuf_release(&buf);
+ if (start_command(&child)) {
remove_tempfile();
- error("error running textconv command '%s'", pgm);
return NULL;
}
+
+ if (strbuf_read(&buf, child.out, 0) < 0)
+ err = error("error reading from textconv command '%s'", pgm);
close(child.out);
+
+ if (finish_command(&child) || err) {
+ strbuf_release(&buf);
+ remove_tempfile();
+ return NULL;
+ }
remove_tempfile();
return strbuf_detach(&buf, outsize);