Imported Upstream version 2.13.3
[platform/upstream/git.git] / editor.c
index 27bdecd..7519ede 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;
+               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;
@@ -64,7 +63,6 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
        if (!buffer)
                return 0;
        if (strbuf_read_file(buffer, path, 0) < 0)
-               return error("could not read file '%s': %s",
-                               path, strerror(errno));
+               return error_errno("could not read file '%s'", path);
        return 0;
 }