From 5c0d30fbd73ee5e9f080d0763ec08eb68fe69314 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 24 Apr 2013 22:26:33 -0500 Subject: [PATCH] Win32: Show at most 5 hard linking warnings --- src/wimlib_internal.h | 13 ++++++++----- src/win32.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/wimlib_internal.h b/src/wimlib_internal.h index bde430f1..5e390efe 100644 --- a/src/wimlib_internal.h +++ b/src/wimlib_internal.h @@ -553,18 +553,21 @@ struct apply_args { struct _ntfs_volume *vol; }; #endif - struct { - /* Normal apply only (UNIX) */ - unsigned long num_utime_warnings; - }; - + #ifdef __WIN32__ struct { /* Normal apply only (Win32) */ unsigned long num_set_sacl_priv_notheld; unsigned long num_set_sd_access_denied; unsigned vol_flags; + unsigned long num_hard_links_failed; bool have_vol_flags; }; + #else + struct { + /* Normal apply only (UNIX) */ + unsigned long num_utime_warnings; + }; + #endif }; }; diff --git a/src/win32.c b/src/win32.c index 4a9e8bec..10f28b3d 100644 --- a/src/win32.c +++ b/src/win32.c @@ -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; @@ -1858,10 +1859,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..."); + } } } -- 2.43.0