Re: [PATCH] Fix git-init-db creating crap directories (zeroth try)

From: Petr Baudis <pasky@suse.cz>
Date: 2005-09-20 11:51:54
Dear diary, on Tue, Sep 20, 2005 at 02:42:47AM CEST, I got a letter
where "H. Peter Anvin" <hpa@zytor.com> told me that...
> Petr Baudis wrote:
> >>>
> >>>-	memcpy(path, git_dir, len);
> >>>+	memcpy(path, git_dir, len-1);
> >>>+	path[len] = 0;
> >>>	copy_templates_1(path, len,
> >>
> >>Wrong!  You're not initializing path[len-1]!
> >
> >
> >Oops, sorry. That's what you get when you want to make things marginally
> >better. ;-) We indeed want to pass copy_templates_1() the trailing slash
> >as well.
> >
> >Let's just settle with the original patch then.
> >
> 
> But if len is the index of the '/', then you're not.

But fortunately len is not the index of the '/', len-1 is. len is the length
of the leading path fragment including the trailing slash.

-- 
				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
Received on Tue Sep 20 11:52:40 2005

This archive was generated by hypermail 2.1.8 : 2005-09-20 11:52:43 EST