]> asedeno.scripts.mit.edu Git - git.git/blobdiff - receive-pack.c
Merge git://git.kernel.org/pub/scm/gitk/gitk
[git.git] / receive-pack.c
index d0a563df6457a6fc5b40b3502582a78fafdadd53..f83ae87e150ff93728da989f1d35ce0ad7c10f60 100644 (file)
@@ -132,6 +132,7 @@ static int run_hook(const char *hook_name)
                                break;
                }
        }
+       close(proc.in);
        return hook_status(finish_command(&proc), hook_name);
 }
 
@@ -165,7 +166,8 @@ static const char *update(struct command *cmd)
        unsigned char *new_sha1 = cmd->new_sha1;
        struct ref_lock *lock;
 
-       if (!prefixcmp(name, "refs/") && check_ref_format(name + 5)) {
+       /* only refs/... are allowed */
+       if (prefixcmp(name, "refs/") || check_ref_format(name + 5)) {
                error("refusing to create funny ref '%s' remotely", name);
                return "funny refname";
        }
@@ -413,6 +415,7 @@ static const char *unpack(void)
                if (start_command(&ip))
                        return "index-pack fork failed";
                pack_lockfile = index_pack_lockfile(ip.out);
+               close(ip.out);
                status = finish_command(&ip);
                if (!status) {
                        reprepare_packed_git();
@@ -468,6 +471,8 @@ int main(int argc, char **argv)
        if (!dir)
                usage(receive_pack_usage);
 
+       setup_path(NULL);
+
        if (!enter_repo(dir, 0))
                die("'%s': unable to chdir or not a git archive", dir);