X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fbucket.c;h=e35f99f8cc011805f6a000ad724eeb3aa6a07ff4;hb=7cad2aea777893dbacb8ae00aeeff81b319cb7d1;hp=626c87ac642dd029d5d12b4c84846d77759c8557;hpb=03022b7924c6ddeadaa056c0f2a1b2930bbf490d;p=libucw.git diff --git a/lib/bucket.c b/lib/bucket.c index 626c87ac..e35f99f8 100644 --- a/lib/bucket.c +++ b/lib/bucket.c @@ -349,27 +349,29 @@ obuck_shakedown(int (*kibitz)(struct obuck_header *old, oid_t new, byte *buck)) goto reread; if (GET_U32(rbuf + roff + l - 4) != OBUCK_TRAILER) obuck_broken("missing trailer during shakedown"); - if (rhdr->oid != OBUCK_OID_DELETED && - kibitz(rhdr, w_bucket_start >> OBUCK_SHIFT, (byte *)(rhdr+1))) + if (rhdr->oid != OBUCK_OID_DELETED) { - if (bucket_start == w_bucket_start) + if (kibitz(rhdr, w_bucket_start >> OBUCK_SHIFT, (byte *)(rhdr+1))) { - /* No copying needed now nor ever in the past, hence woff==0 */ - wstart += l; - } - else - { - if (obuck_shake_buflen - woff < l) + if (bucket_start == w_bucket_start) + { + /* No copying needed now nor ever in the past, hence woff==0 */ + wstart += l; + } + else { - if (sh_pwrite(obuck_fd, wbuf, woff, wstart) != woff) - die("obuck_shakedown write failed: %m"); - wstart += woff; - woff = 0; + if (obuck_shake_buflen - woff < l) + { + if (sh_pwrite(obuck_fd, wbuf, woff, wstart) != woff) + die("obuck_shakedown write failed: %m"); + wstart += woff; + woff = 0; + } + whdr = (struct obuck_header *)(wbuf+woff); + memcpy(whdr, rhdr, l); + whdr->oid = w_bucket_start >> OBUCK_SHIFT; + woff += l; } - whdr = (struct obuck_header *)(wbuf+woff); - memcpy(whdr, rhdr, l); - whdr->oid = w_bucket_start >> OBUCK_SHIFT; - woff += l; } } else