From d5447ec541b245fa91dac72ce2822bdaafc30f6c Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 20 May 2013 19:56:36 -0500 Subject: [PATCH] Win32: Use OPEN_EXISTING creation disposition on drive root --- src/win32_apply.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/win32_apply.c b/src/win32_apply.c index 11104f24..972224ef 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -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. */ - 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 && -- 2.43.0