]> wimlib.net Git - wimlib/blobdiff - src/win32.c
Win32: Do not create lookup table entries for 0 length streams
[wimlib] / src / win32.c
index 4a9e8becec2a762876765834e0d8dc9d4655002e..1b2aeffe597189f77396dd2a864a5ec54262c943 100644 (file)
@@ -46,6 +46,7 @@
 
 #define MAX_GET_SD_ACCESS_DENIED_WARNINGS 1
 #define MAX_GET_SACL_PRIV_NOTHELD_WARNINGS 1
+#define MAX_CREATE_HARD_LINK_WARNINGS 5
 struct win32_capture_state {
        unsigned long num_get_sd_access_denied;
        unsigned long num_get_sacl_priv_notheld;
@@ -875,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
@@ -1858,10 +1865,15 @@ win32_do_apply_dentry(const wchar_t *output_path,
                        win32_error(err);
                        return WIMLIB_ERR_LINK;
                } else {
-                       WARNING("Can't create hard link \"%ls => %ls\":\n"
-                               "          Volume does not support hard links!\n"
-                               "          Falling back to extracting a copy of the file.",
-                               output_path, inode->i_extracted_file);
+                       args->num_hard_links_failed++;
+                       if (args->num_hard_links_failed < MAX_CREATE_HARD_LINK_WARNINGS) {
+                               WARNING("Can't create hard link \"%ls => %ls\":\n"
+                                       "          Volume does not support hard links!\n"
+                                       "          Falling back to extracting a copy of the file.",
+                                       output_path, inode->i_extracted_file);
+                       } else if (args->num_hard_links_failed == MAX_CREATE_HARD_LINK_WARNINGS) {
+                               WARNING("Suppressing further hard linking warnings...");
+                       }
                }
        }