]> git.ipfire.org Git - thirdparty/git.git/blobdiff - diff.c
Merge branch 'jk/maint-rmdir-fix' into maint-1.6.6
[thirdparty/git.git] / diff.c
diff --git a/diff.c b/diff.c
index 08bbd3e9070996b38f4d34cedf7640d93aa5808d..7a321f4254cf25101f9c9ed5df1621e3bf4b2e29 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2855,6 +2855,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
                ;
        else if (!prefixcmp(arg, "--output=")) {
                options->file = fopen(arg + strlen("--output="), "w");
+               if (!options->file)
+                       die_errno("Could not open '%s'", arg + strlen("--output="));
                options->close_file = 1;
        } else
                return 0;
@@ -3776,11 +3778,13 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
        if (start_command(&child) != 0 ||
            strbuf_read(&buf, child.out, 0) < 0 ||
            finish_command(&child) != 0) {
+               close(child.out);
                strbuf_release(&buf);
                remove_tempfile();
                error("error running textconv command '%s'", pgm);
                return NULL;
        }
+       close(child.out);
        remove_tempfile();
 
        return strbuf_detach(&buf, outsize);