Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: git.c: two fixes, gitsetenv type and off-by-one error.
Date: Sun, 04 Dec 2005 15:03:13 -0800	[thread overview]
Message-ID: <7vhd9oea8e.fsf@assigned-by-dhcp.cox.net> (raw)

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>

---

 git.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

9a79c5a8b4e280601bcbeeed22e1e4968d06c10e
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 *
 	path_len = len + strlen(old_path) + 1;
 
 	path = malloc(path_len + 1);
-	path[path_len + 1] = '\0';
 
 	memcpy(path, dir, len);
 	path[len] = ':';
-- 
0.99.9.GIT

                 reply	other threads:[~2005-12-04 23:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vhd9oea8e.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox