]> wimlib.net Git - wimlib/commitdiff
Win32: Use OPEN_EXISTING creation disposition on drive root
authorEric Biggers <ebiggers3@gmail.com>
Tue, 21 May 2013 00:56:36 +0000 (19:56 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 21 May 2013 00:56:36 +0000 (19:56 -0500)
src/win32_apply.c

index 11104f24bc88404d2ba2b5cbc94b8a1b593fa140..972224efad978188b191c217508fe734ba2fd2a8 100644 (file)
@@ -601,18 +601,19 @@ win32_begin_extract_unnamed_stream(const struct wim_inode *inode,
        /* Directories must be created with CreateDirectoryW().  Then the call
         * to CreateFileW() will merely open the directory that was already
         * created rather than creating a new file. */
        /* Directories must be created with CreateDirectoryW().  Then the call
         * to CreateFileW() will merely open the directory that was already
         * created rather than creating a new file. */
-       if (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY &&
-           !path_is_root_of_drive(path)) {
-               if (!CreateDirectoryW(path, NULL)) {
-                       err = GetLastError();
-                       if (err != ERROR_ALREADY_EXISTS) {
-                               ERROR("Failed to create directory \"%ls\"",
-                                     path);
-                               win32_error(err);
-                               return WIMLIB_ERR_MKDIR;
+       if (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY) {
+               if (!path_is_root_of_drive(path)) {
+                       if (!CreateDirectoryW(path, NULL)) {
+                               err = GetLastError();
+                               if (err != ERROR_ALREADY_EXISTS) {
+                                       ERROR("Failed to create directory \"%ls\"",
+                                             path);
+                                       win32_error(err);
+                                       return WIMLIB_ERR_MKDIR;
+                               }
                        }
                        }
+                       DEBUG("Created directory \"%ls\"", path);
                }
                }
-               DEBUG("Created directory \"%ls\"", path);
                *creationDisposition_ret = OPEN_EXISTING;
        }
        if (inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED &&
                *creationDisposition_ret = OPEN_EXISTING;
        }
        if (inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED &&