From: Brandon Low Date: Tue, 8 Feb 2011 18:43:22 +0000 (-0800) Subject: midx4: Fix name offsets when generated from idx X-Git-Tag: bup-0.23~14 X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=970d5bf11bc96cd6974bf7665d67e1174abe3750 midx4: Fix name offsets when generated from idx This was a nasty bug, glad it got found before release. Only effected the server's ability to suggest .idxs so far, but would have effected any attempt to have bup retrieve objects directly too. Signed-off-by: Brandon Low --- diff --git a/lib/bup/_helpers.c b/lib/bup/_helpers.c index 938b7a3..0af9411 100644 --- a/lib/bup/_helpers.c +++ b/lib/bup/_helpers.c @@ -330,7 +330,10 @@ static PyObject *merge_into(PyObject *self, PyObject *args) return NULL; idxs[i]->cur = (struct sha *)&idxs[i]->map[sha_ofs]; idxs[i]->end = &idxs[i]->cur[len]; - idxs[i]->cur_name = (uint32_t *)&idxs[i]->map[name_map_ofs]; + if (name_map_ofs) + idxs[i]->cur_name = (uint32_t *)&idxs[i]->map[name_map_ofs]; + else + idxs[i]->cur_name = NULL; } table_ptr = (uint32_t *)&fmap[12]; sha_ptr = (struct sha *)&table_ptr[1<