Re: [PATCH 5/8] get-repack --max-pack-size: write_object() takes 'limit' arg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/8/07, Nicolas Pitre <nico@xxxxxxx> wrote:
> @@ -448,6 +480,12 @@ static off_t write_object(struct sha1file *f,
>                       header[pos] = ofs & 127;
>                       while (ofs >>= 7)
>                               header[--pos] = 128 | (--ofs & 127);
> +                     if ( limit && hdrlen + sizeof(header) - pos + datalen + 20 >= limit ) {
> +                             free(out);
> +                             free(buf);
> +                             return 0;
> +                     }
> +                     sha1write(f, header, hdrlen);
>                       sha1write(f, header + pos, sizeof(header) - pos);

The above looks rather buggy to me.

OK, can you be more specific?

So far from my re-inspection I don't see any error in the snippet above.
Two lines before it, however, we have the line
       off_t ofs = entry->offset - entry->delta->offset;
and this only works if entry->offset is set in write_one() *before*
calling write_object().  I will make that change.

Thanks!
--
Dana L. How  danahow@xxxxxxxxx  +1 650 804 5991 cell
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]