+ goto out_fclose;
+ } else {
+ new_compressed_size = old_compressed_size;
+ }
+
+ if (new_compressed_size > original_size) {
+ /* Oops! We compressed the resource to larger than the original
+ * size. Write the resource uncompressed instead. */
+ if (fseeko(out_fp, file_offset, SEEK_SET) != 0) {
+ ERROR_WITH_ERRNO("Failed to seek to byte "PRIu64" "
+ "of output WIM file", file_offset);
+ ret = WIMLIB_ERR_WRITE;
+ goto out_fclose;
+ }
+ ret = write_wim_resource(lte, out_fp, WIM_COMPRESSION_TYPE_NONE,
+ out_res_entry);
+ if (ret != 0)
+ goto out_fclose;
+ if (fflush(out_fp) != 0) {
+ ERROR_WITH_ERRNO("Failed to flush output WIM file");
+ ret = WIMLIB_ERR_WRITE;
+ goto out_fclose;
+ }
+ if (ftruncate(fileno(out_fp), file_offset + out_res_entry->size) != 0) {
+ ERROR_WITH_ERRNO("Failed to truncate output WIM file");
+ ret = WIMLIB_ERR_WRITE;
+ }
+ goto out_fclose;