]> wimlib.net Git - wimlib/commitdiff
Win32 apply: Only retry on sharing violations with encrypted directories
authorEric Biggers <ebiggers3@gmail.com>
Tue, 21 May 2013 16:28:09 +0000 (11:28 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 21 May 2013 16:28:09 +0000 (11:28 -0500)
src/win32_apply.c

index 1737fa1b49d0e9040cfe83f3efe393836240fc44..ce20fe6116744726b0e4d394d430ce4522db98a8 100644 (file)
@@ -863,7 +863,11 @@ try_open_again:
                        requestedAccess &= ~ACCESS_SYSTEM_SECURITY;
                        goto 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
                        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 {
                                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;
        }
                ret = WIMLIB_ERR_OPEN;
                goto fail;
        }