Fix the expansion pattern of the pseudo-static path buffer.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Pierre Habouzit committed
Sep 20, 2007 at 00:42 UTC
e03e05ff73a6f6b4f32eb5cd13b4f1e43275e42f
1 file changed
+2
-3
archive-tar.c
+2
-3
@@ -238,15 +238,14 @@ static int write_tar_entry(const unsigned char *sha1,
238
const char *filename, unsigned mode, int stage)
239
{
240
static struct strbuf path = STRBUF_INIT;
241
- int filenamelen = strlen(filename);
241
void *buffer;
242
enum object_type type;
243
unsigned long size;
244
246
- strbuf_grow(&path, MAX(PATH_MAX, baselen + filenamelen + 1));
245
strbuf_reset(&path);
246
+ strbuf_grow(&path, PATH_MAX);
247
strbuf_add(&path, base, baselen);
249
- strbuf_add(&path, filename, filenamelen);
248
+ strbuf_addstr(&path, filename);
249
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
250
strbuf_addch(&path, '/');
251
buffer = NULL;