From a46a4f0e37774d359808504bb69258c26945fd20 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 21 May 2013 11:28:09 -0500 Subject: [PATCH 1/1] Win32 apply: Only retry on sharing violations with encrypted directories --- src/win32_apply.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/win32_apply.c b/src/win32_apply.c index 1737fa1b..ce20fe61 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -863,7 +863,11 @@ try_open_again: requestedAccess &= ~ACCESS_SYSTEM_SECURITY; goto try_open_again; } - if (err == ERROR_SHARING_VIOLATION) { + if (err == ERROR_SHARING_VIOLATION && + (inode->i_attributes & (FILE_ATTRIBUTE_ENCRYPTED | + FILE_ATTRIBUTE_DIRECTORY)) == + (FILE_ATTRIBUTE_ENCRYPTED | FILE_ATTRIBUTE_DIRECTORY)) + { if (remaining_sharing_violations) { --remaining_sharing_violations; /* This can happen when restoring encrypted directories @@ -875,13 +879,12 @@ try_open_again: } else { ERROR("Too many sharing violations; giving up..."); } - } else { - if (creationDisposition == OPEN_EXISTING) - ERROR("Failed to open \"%ls\"", stream_path); - else - ERROR("Failed to create \"%ls\"", stream_path); - win32_error(err); } + if (creationDisposition == OPEN_EXISTING) + ERROR("Failed to open \"%ls\"", stream_path); + else + ERROR("Failed to create \"%ls\"", stream_path); + win32_error(err); ret = WIMLIB_ERR_OPEN; goto fail; } -- 2.43.0