X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-archive.c;h=8ea6cb1efc4f988fb09051852f9e51fc88b5efd7;hb=0dc03d6a30213e9aa0eb88886cee24b993a24a29;hp=391cf43911a16ec49862c18b7dd4f1f094d49de8;hpb=85023577a8f4b540aa64aa37f6f44578c0c305a3;p=git.git diff --git a/builtin-archive.c b/builtin-archive.c index 391cf4391..8ea6cb1ef 100644 --- a/builtin-archive.c +++ b/builtin-archive.c @@ -35,7 +35,7 @@ static int run_remote_archiver(const char *remote, int argc, for (i = 1; i < argc; i++) { const char *arg = argv[i]; - if (!strncmp("--exec=", arg, 7)) { + if (!prefixcmp(arg, "--exec=")) { if (exec_at) die("multiple --exec specified"); exec = arg + 7; @@ -62,7 +62,7 @@ static int run_remote_archiver(const char *remote, int argc, if (buf[len-1] == '\n') buf[--len] = 0; if (strcmp(buf, "ACK")) { - if (len > 5 && !strncmp(buf, "NACK ", 5)) + if (len > 5 && !prefixcmp(buf, "NACK ")) die("git-archive: NACK %s", buf + 5); die("git-archive: protocol error"); } @@ -74,6 +74,7 @@ static int run_remote_archiver(const char *remote, int argc, /* Now, start reading from fd[0] and spit it out to stdout */ rv = recv_sideband("archive", fd[0], 1, 2); close(fd[0]); + close(fd[1]); rv |= finish_connect(pid); return !!rv; @@ -137,7 +138,6 @@ void parse_treeish_arg(const char **argv, struct archiver_args *ar_args, if (err || !S_ISDIR(mode)) die("current working directory is untracked"); - free(tree); tree = parse_tree_indirect(tree_sha1); } ar_args->tree = tree; @@ -166,11 +166,11 @@ int parse_archive_args(int argc, const char **argv, struct archiver *ar) verbose = 1; continue; } - if (!strncmp(arg, "--format=", 9)) { + if (!prefixcmp(arg, "--format=")) { format = arg + 9; continue; } - if (!strncmp(arg, "--prefix=", 9)) { + if (!prefixcmp(arg, "--prefix=")) { base = arg + 9; continue; } @@ -218,7 +218,7 @@ static const char *extract_remote_arg(int *ac, const char **av) if (!strcmp(arg, "--")) no_more_options = 1; if (!no_more_options) { - if (!strncmp(arg, "--remote=", 9)) { + if (!prefixcmp(arg, "--remote=")) { if (remote) die("Multiple --remote specified"); remote = arg + 9;