summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMoritz Bechler <mbechler@eenterphace.org>2011-12-19 16:36:31 +0100
committerStephan Bergmann <sbergman@redhat.com>2011-12-19 16:36:31 +0100
commit32a6a0891fb5f2d893cca656cd44afd0bcbe3272 (patch)
tree279ffe98391cf3924d542c29851873c3e07f24f5 /sal
parent47dda946060068ac4d16ed5e59ccbc12012f9048 (diff)
fdo#43095: allow the use of real access() calls
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file_stat.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx
index 674e6037e308..6b2407adc0fb 100644
--- a/sal/osl/unx/file_stat.cxx
+++ b/sal/osl/unx/file_stat.cxx
@@ -163,6 +163,22 @@ namespace /* private */
}
}
+ /* contrary to what is stated above the use of access calls
+ is required on network file systems not using unix semantics
+ (AFS)
+ */
+ inline void set_file_access_real_rights(const rtl::OUString& file_path, oslFileStatus* pStat)
+ {
+ pStat->uValidFields |= osl_FileStatus_Mask_Attributes;
+
+ if (access_u(file_path.pData, W_OK) < 0)
+ pStat->uAttributes |= osl_File_Attribute_ReadOnly;
+
+ if (access_u(file_path.pData, X_OK) == 0)
+ pStat->uAttributes |= osl_File_Attribute_Executable;
+ }
+
+
inline void set_file_hidden_status(const rtl::OUString& file_path, oslFileStatus* pStat)
{
pStat->uAttributes = osl::systemPathIsHiddenFileOrDirectoryEntry(file_path) ? osl_File_Attribute_Hidden : 0;
@@ -177,10 +193,15 @@ namespace /* private */
set_file_hidden_status(file_path, pStat);
set_file_access_mask(file_stat, pStat);
+#ifdef FAKE_ACCESS_RIGHTS
// we set the file access rights only on demand
// because it's potentially expensive
if (uFieldMask & osl_FileStatus_Mask_Attributes)
set_file_access_rights(file_stat, pStat);
+#else
+ if (uFieldMask & osl_FileStatus_Mask_Attributes)
+ set_file_access_real_rights(file_path, pStat);
+#endif
}
inline void set_file_access_time(const struct stat& file_stat, oslFileStatus* pStat)