From: Eric Biggers Date: Sat, 6 Jun 2015 19:26:37 +0000 (-0500) Subject: Don't ftruncate() after rewriting blob uncompressed X-Git-Tag: v1.8.2~66 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=239c797de4d6fb592a5c5f512cac0fa375864e12 Don't ftruncate() after rewriting blob uncompressed --- diff --git a/src/write.c b/src/write.c index c1d56de3..b2e687a8 100644 --- a/src/write.c +++ b/src/write.c @@ -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 |