]> wimlib.net Git - wimlib/commitdiff
Win32: Do not create lookup table entries for 0 length streams
authorEric Biggers <ebiggers3@gmail.com>
Thu, 25 Apr 2013 04:07:31 +0000 (23:07 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 25 Apr 2013 04:07:31 +0000 (23:07 -0500)
src/win32.c
src/write.c

index 10f28b3d91280106d4955526f30bc8b10ddf0203..1b2aeffe597189f77396dd2a864a5ec54262c943 100644 (file)
@@ -876,6 +876,12 @@ win32_capture_stream(const wchar_t *path,
                }
        }
 
+       /* If zero length stream, no lookup table entry needed. */
+       if ((u64)dat->StreamSize.QuadPart == 0) {
+               ret = 0;
+               goto out;
+       }
+
        /* Create a UTF-16LE string @spath that gives the filename, then a
         * colon, then the stream name.  Or, if it's an unnamed stream, just the
         * filename.  It is MALLOC()'ed so that it can be saved in the
index 311eff9ca23f5dc40e5c3a384e8464f603a204b4..8b09449036b2ac52ad016278fe6f0f4180a91700 100644 (file)
@@ -94,6 +94,8 @@ begin_wim_resource_chunk_tab(const struct wim_lookup_table_entry *lte,
        size_t alloc_size = sizeof(struct chunk_table) + num_chunks * sizeof(u64);
        struct chunk_table *chunk_tab = CALLOC(1, alloc_size);
 
+       DEBUG("Begin chunk table for stream with size %"PRIu64, size);
+
        if (!chunk_tab) {
                ERROR("Failed to allocate chunk table for %"PRIu64" byte "
                      "resource", size);