X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwrite.c;h=b595c875e08e08e80313aa3bd2e363e8577df2d3;hb=ce50e9190bdb770640a53a1a8d612229be65d8e7;hp=c1d56de3001d1a37d166d22ec6daa9ee6dce163e;hpb=c86d5f74e13e5aeff57aff84f7d65264607a29ac;p=wimlib diff --git a/src/write.c b/src/write.c index c1d56de3..b595c875 100644 --- a/src/write.c +++ b/src/write.c @@ -548,9 +548,9 @@ end_chunk_table(struct write_blobs_ctx *ctx, u64 res_actual_size, hdr.chunk_size = cpu_to_le32(ctx->out_chunk_size); hdr.compression_format = cpu_to_le32(ctx->out_ctype); - BUILD_BUG_ON(WIMLIB_COMPRESSION_TYPE_XPRESS != 1); - BUILD_BUG_ON(WIMLIB_COMPRESSION_TYPE_LZX != 2); - BUILD_BUG_ON(WIMLIB_COMPRESSION_TYPE_LZMS != 3); + STATIC_ASSERT(WIMLIB_COMPRESSION_TYPE_XPRESS == 1); + STATIC_ASSERT(WIMLIB_COMPRESSION_TYPE_LZX == 2); + STATIC_ASSERT(WIMLIB_COMPRESSION_TYPE_LZMS == 3); ret = full_pwrite(ctx->out_fd, &hdr, sizeof(hdr), chunk_table_offset - sizeof(hdr)); @@ -769,13 +769,9 @@ write_blob_uncompressed(struct blob_descriptor *blob, struct filedes *out_fd) wimlib_assert(out_fd->offset - begin_offset == blob->size); - if (out_fd->offset < end_offset && - 0 != ftruncate(out_fd->fd, out_fd->offset)) - { - ERROR_WITH_ERRNO("Can't truncate output file to " - "offset %"PRIu64, out_fd->offset); - return WIMLIB_ERR_WRITE; - } + /* We could ftruncate() the file to 'out_fd->offset' here, but there + * isn't much point. Usually we will only be truncating by a few bytes + * and will just overwrite the data immediately. */ blob->out_reshdr.size_in_wim = blob->size; blob->out_reshdr.flags &= ~(WIM_RESHDR_FLAG_COMPRESSED |