瀏覽代碼

* Only add SIZE_[PACK|CONF] to skip_bytes if we are writing them

svn: 1758
Bryan Drewery 21 年之前
父節點
當前提交
d6ff6e63f2
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/binary.c

+ 3 - 2
src/binary.c

@@ -113,8 +113,9 @@ bin_checksum(const char *fname, int todo, MD5_CTX * ctx)
 
 
         /* just write both for now */
         /* just write both for now */
         todo |= WRITE_PACK|WRITE_CONF;
         todo |= WRITE_PACK|WRITE_CONF;
-        skip_bytes += SIZE_PACK;
+
         if (todo & WRITE_PACK) {
         if (todo & WRITE_PACK) {
+          skip_bytes += SIZE_PACK;
           fwrite(&settings.hash, SIZE_PACK, 1, newbin->f);
           fwrite(&settings.hash, SIZE_PACK, 1, newbin->f);
           sdprintf("writing pack: %d\n", SIZE_PACK);
           sdprintf("writing pack: %d\n", SIZE_PACK);
         } else {
         } else {
@@ -125,8 +126,8 @@ bin_checksum(const char *fname, int todo, MD5_CTX * ctx)
 
 
         pos += SIZE_PACK;
         pos += SIZE_PACK;
 
 
-        skip_bytes += SIZE_CONF;
         if (todo & WRITE_CONF) {
         if (todo & WRITE_CONF) {
+          skip_bytes += SIZE_CONF;
           fwrite(&settings.bots, SIZE_CONF, 1, newbin->f);
           fwrite(&settings.bots, SIZE_CONF, 1, newbin->f);
           sdprintf("writing conf: %d\n", SIZE_CONF);
           sdprintf("writing conf: %d\n", SIZE_CONF);
         } else {
         } else {