]> wimlib.net Git - wimlib/blobdiff - src/write.c
wim.c: Remove reopen_wim(), close_wim()
[wimlib] / src / write.c
index a852c199670c9a6265cc043be19a6908d98c9ecb..1df05c95402c7570802c6b2c6a3a83abe7b2aeee 100644 (file)
@@ -1430,11 +1430,11 @@ write_stream_list(struct list_head *stream_list,
         * to do compression.  There are serial and parallel implementations of
         * the chunk_compressor interface.  We default to parallel using the
         * specified number of threads, unless the upper bound on the number
-        * bytes needing to be compressed is less 2000000 (heuristic value).  */
+        * bytes needing to be compressed is less than a heuristic value.  */
        if (out_ctype != WIMLIB_COMPRESSION_TYPE_NONE) {
 
        #ifdef ENABLE_MULTITHREADED_COMPRESSION
-               if (ctx.num_bytes_to_compress >= 2000000) {
+               if (ctx.num_bytes_to_compress > max(2000000, out_chunk_size)) {
                        ret = new_parallel_chunk_compressor(out_ctype,
                                                            out_chunk_size,
                                                            num_threads, 0,
@@ -3123,7 +3123,10 @@ overwrite_wim_via_tmpfile(WIMStruct *wim, int write_flags,
                return ret;
        }
 
-       close_wim(wim);
+       if (filedes_valid(&wim->in_fd)) {
+               filedes_close(&wim->in_fd);
+               filedes_invalidate(&wim->in_fd);
+       }
 
        /* Rename the new WIM file to the original WIM file.  Note: on Windows
         * this actually calls win32_rename_replacement(), not _wrename(), so