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>
Junio C Hamano committed
Dec 4, 2005 at 14:59 UTC
9a79c5a8b4e280601bcbeeed22e1e4968d06c10e
1 file changed
+1
-2
git.c
+1
-2
@@ -14,7 +14,7 @@
14
#endif
15
16
#ifdef NO_SETENV
17
-extern int gitsetenv(char *name, char *value, int overwrite);
17
+extern int gitsetenv(const char *, const char *, int);
18
#endif
19
20
static const char git_usage[] =
@@ -192,7 +192,6 @@ static void prepend_to_path(const char *dir, int len)
192
path_len = len + strlen(old_path) + 1;
193
194
path = malloc(path_len + 1);
195
- path[path_len + 1] = '\0';
195
196
memcpy(path, dir, len);
197
path[len] = ':';