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;
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");
}
/* 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;
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;
}
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;