From 41698375ada57d51cf6db5cf25970ccd1b918180 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 12 Sep 2009 10:43:27 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- builtin-add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin-add.c') 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"); -- cgit v1.2.3