Revision f2b7c8b3

b/block/qcow2-refcount.c
168 168

  
169 169
    cpu_to_be64w((uint64_t*)data, table_offset);
170 170
    cpu_to_be32w((uint32_t*)(data + 8), refcount_table_clusters);
171
    if (bdrv_pwrite(s->hd, offsetof(QCowHeader, refcount_table_offset),
172
                    data, sizeof(data)) != sizeof(data))
171
    ret = bdrv_pwrite(s->hd, offsetof(QCowHeader, refcount_table_offset),
172
                    data, sizeof(data));
173
    if (ret != sizeof(data)) {
173 174
        goto fail;
175
    }
176

  
174 177
    qemu_free(s->refcount_table);
175 178
    old_table_offset = s->refcount_table_offset;
176 179
    old_table_size = s->refcount_table_size;
......
183 186
    return 0;
184 187
 fail:
185 188
    qemu_free(new_table);
186
    return -EIO;
189
    return ret < 0 ? ret : -EIO;
187 190
}
188 191

  
189 192

  

Also available in: Unified diff