From cb64800d83ace6fecb8701151cfdb6ed0712702c Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 12 May 2015 21:21:58 -0400 Subject: add: check return value of launch_editor When running "add -e", if launching the editor fails, we do not notice and continue as if the output is what the user asked for. The likely case is that the editor did not touch the contents at all, and we end up adding everything. Reported-by: Russ Cox Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/add.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/add.c b/builtin/add.c index 459208a32..1c7436589 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -207,7 +207,8 @@ static int edit_patch(int argc, const char **argv, const char *prefix) if (run_diff_files(&rev, 0)) die(_("Could not write patch")); - launch_editor(file, NULL, NULL); + if (launch_editor(file, NULL, NULL)) + die(_("editing patch failed")); if (stat(file, &st)) die_errno(_("Could not stat '%s'"), file); -- cgit v1.2.1