summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-04 22:59:58 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-12-04 22:59:58 (GMT)
commit9a79c5a8b4e280601bcbeeed22e1e4968d06c10e (patch)
tree4957a416f66f1e8afaf189b45136fb4a070eadcb /git.c
parent3a2674337c12e958f8c697af991a0ef6c06ddd4d (diff)
downloadgit-9a79c5a8b4e280601bcbeeed22e1e4968d06c10e.zip
git-9a79c5a8b4e280601bcbeeed22e1e4968d06c10e.tar.gz
git-9a79c5a8b4e280601bcbeeed22e1e4968d06c10e.tar.bz2
git.c: two fixes, gitsetenv type and off-by-one error.
gitsetenv as implemented in compat/setenv.c takes two const char* and int; match that. Also fix an incorrect attempt in prepend_to_path() to NUL-terminate the string which stuffed the NUL character at one past the end of allocation, and was not needed to begin with (we copy the old_path string including the NUL which terminates it). Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git.c')
-rw-r--r--git.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/git.c b/git.c
index 619f25a..0975fc7 100644
--- a/git.c
+++ b/git.c
@@ -14,7 +14,7 @@
#endif
#ifdef NO_SETENV
-extern int gitsetenv(char *name, char *value, int overwrite);
+extern int gitsetenv(const char *, const char *, int);
#endif
static const char git_usage[] =
@@ -192,7 +192,6 @@ static void prepend_to_path(const char *dir, int len)
path_len = len + strlen(old_path) + 1;
path = malloc(path_len + 1);
- path[path_len + 1] = '\0';
memcpy(path, dir, len);
path[len] = ':';