diff options
author | Jim Meyering <meyering@redhat.com> | 2009-09-12 10:43:27 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-09-13 01:32:20 -0700 |
commit | 41698375ada57d51cf6db5cf25970ccd1b918180 (patch) | |
tree | a1ed2b0f32a829bdb0b4cece3d85df933b924962 /builtin-add.c | |
parent | use write_str_in_full helper to avoid literal string lengths (diff) | |
download | tgif-41698375ada57d51cf6db5cf25970ccd1b918180.tar.xz |
don't dereference NULL upon fdopen failure
There were several unchecked use of fdopen(); replace them with xfdopen()
that checks and dies.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-add.c')
-rw-r--r-- | builtin-add.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-add.c b/builtin-add.c index a5714735e6..cb6e5906fb 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -198,7 +198,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix) out = open(file, O_CREAT | O_WRONLY, 0644); if (out < 0) die ("Could not open '%s' for writing.", file); - rev.diffopt.file = fdopen(out, "w"); + rev.diffopt.file = xfdopen(out, "w"); rev.diffopt.close_file = 1; if (run_diff_files(&rev, 0)) die ("Could not write patch"); |