login
Header Space

 
 

[PATCH] Fix git-init-db creating crap directories

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <junkio@...>
Cc: H. Peter Anvin <hpa@...>, Dmitry Torokhov <dtor_core@...>, <git@...>
Date: Monday, September 19, 2005 - 8:07 pm

Dear diary, on Tue, Sep 20, 2005 at 01:58:52AM CEST, I got a letter
where "H. Peter Anvin" <hpa@zytor.com> told me that...

Great. Resending a marginally better version with a cool log message and
everything.

--

The base target directory for the templates copying was initialized
to git_dir, but git_dir[len] is not zero but / at the time we do the
initialization. This is not what we want for our target directory string
since we pass it to mkdir(), so make it zero-terminated manually.

Signed-off-by: Petr Baudis <pasky@suse.cz>

---
commit dbe1fe2f0d6de58bc0c9f98e6cf9573874612890
tree 30398d409fa27e95e3e592c803f6cd5a93652234
parent 79d2a11ec497fe940ca9a1fd8e0b9f295d39c290
author Petr Baudis <pasky@suse.cz> Tue, 20 Sep 2005 01:55:53 +0200
committer Petr Baudis <xpasky@machine.(none)> Tue, 20 Sep 2005 01:55:53 +0200

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

diff --git a/init-db.c b/init-db.c
--- a/init-db.c
+++ b/init-db.c
@@ -153,7 +153,8 @@ static void copy_templates(const char *g
 		return;
 	}
 
-	memcpy(path, git_dir, len);
+	memcpy(path, git_dir, len-1);
+	path[len] = 0;
 	copy_templates_1(path, len,
 			 template_path, template_len,
 			 dir);

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Garbage in .git directories???, Dmitry Torokhov, (Sat Sep 17, 10:41 pm)
Re: Garbage in .git directories???, H. Peter Anvin, (Mon Sep 19, 3:10 pm)
Re: Garbage in .git directories??? , Horst von Brand, (Mon Sep 19, 5:58 pm)
Re: Garbage in .git directories???, Petr Baudis, (Mon Sep 19, 3:44 pm)
Re: Garbage in .git directories???, H. Peter Anvin, (Mon Sep 19, 7:16 pm)
Re: Garbage in .git directories???, Petr Baudis, (Mon Sep 19, 7:40 pm)
Re: Garbage in .git directories???, H. Peter Anvin, (Mon Sep 19, 7:58 pm)
[PATCH] Fix git-init-db creating crap directories, Petr Baudis, (Mon Sep 19, 8:07 pm)
Re: [PATCH] Fix git-init-db creating crap directories, H. Peter Anvin, (Mon Sep 19, 8:09 pm)
Re: Garbage in .git directories???, Linus Torvalds, (Sun Sep 18, 1:10 pm)
Re: Garbage in .git directories???, Dmitry Torokhov, (Sun Sep 18, 1:54 pm)
Re: Garbage in .git directories???, Dmitry Torokhov, (Mon Sep 19, 12:33 am)
Re: Garbage in .git directories???, Linus Torvalds, (Mon Sep 19, 10:51 am)
Re: Garbage in .git directories???, Dmitry Torokhov, (Mon Sep 19, 8:09 pm)
Re: Garbage in .git directories???, Linus Torvalds, (Mon Sep 19, 8:45 pm)
Re: Garbage in .git directories???, Dmitry Torokhov, (Mon Sep 19, 11:37 pm)
Re: Garbage in .git directories???, Dmitry Torokhov, (Mon Sep 19, 11:00 am)
Re: Garbage in .git directories???, Junio C Hamano, (Mon Sep 19, 1:21 am)
speck-geostationary