index-pack: kill union delta_base to save memory
[gitweb.git] / editor.c
index c892a81ae374eeaa1abd3dcd3be1ae20b1b0db42..01c644cddbe8e57e31cc711aa0ca3838cf23c64d 100644 (file)
--- a/editor.c
+++ b/editor.c
@@ -37,11 +37,10 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
                return error("Terminal is dumb, but EDITOR unset");
 
        if (strcmp(editor, ":")) {
-               const char *args[] = { editor, path, NULL };
-               struct child_process p;
-               int ret;
+               const char *args[] = { editor, real_path(path), NULL };
+               struct child_process p = CHILD_PROCESS_INIT;
+               int ret, sig;
 
-               memset(&p, 0, sizeof(p));
                p.argv = args;
                p.env = env;
                p.use_shell = 1;
@@ -51,8 +50,11 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
                sigchain_push(SIGINT, SIG_IGN);
                sigchain_push(SIGQUIT, SIG_IGN);
                ret = finish_command(&p);
+               sig = ret - 128;
                sigchain_pop(SIGINT);
                sigchain_pop(SIGQUIT);
+               if (sig == SIGINT || sig == SIGQUIT)
+                       raise(sig);
                if (ret)
                        return error("There was a problem with the editor '%s'.",
                                        editor);