apply --root: thinkofix.

The end of a string is string[length-1], not string[length+1].
I pointed it out during the review, but I forgot about it when applying the
patch.  This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2008-07-02 15:28:22 -07:00
parent c4730f35cc
commit 8ee4a6c2ec
2 changed files with 15 additions and 4 deletions

View File

@ -3130,10 +3130,10 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
inaccurate_eof = 1;
continue;
}
if (!strncmp(arg, "--root=", strlen("--root="))) {
if (!prefixcmp(arg, "--root=")) {
arg += strlen("--root=");
root_len = strlen(arg);
if (root_len && arg[root_len + 1] != '/') {
if (root_len && arg[root_len - 1] != '/') {
char *new_root;
root = new_root = xmalloc(root_len + 2);
strcpy(new_root, arg);