summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-09-26 09:52:29 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-09-26 11:59:54 +0200
commitd724b51c7da391c9afe5e47476d432aecf1c4c67 (patch)
tree41bbaecf5d886bf0b77e1f2753687819bce77131 /sal
parenta691337aaa79e03f12b87f9fc2ce85857d9fb621 (diff)
tdf#157448: ignore FILE_ATTRIBUTE_READONLY when FILE_ATTRIBUTE_DIRECTORY is set
Change-Id: I3fbcf15924b30e2c7fe5501e706cdaf32921e103 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157263 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/file_dirvol.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index f9d821605e86..f0c03d0d0033 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -1553,6 +1553,10 @@ oslFileError SAL_CALL osl_getFileStatus(
pStatus->uValidFields |= osl_FileStatus_Mask_Type;
pStatus->uAttributes = pItemImpl->FindData.dwFileAttributes;
+ // tdf#157448: RO attribute is ignored for directories on Windows:
+ // https://learn.microsoft.com/en-us/windows/desktop/FileIO/file-attribute-constants
+ if (pStatus->uAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ pStatus->uAttributes &= ~sal_uInt64(FILE_ATTRIBUTE_READONLY);
pStatus->uValidFields |= osl_FileStatus_Mask_Attributes;
pStatus->uFileSize = static_cast<sal_uInt64>(pItemImpl->FindData.nFileSizeLow) + (static_cast<sal_uInt64>(pItemImpl->FindData.nFileSizeHigh) << 32);