summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 58521d48b..c0f0ed74d 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -950,6 +950,10 @@ fhandler_disk_file::fstat (struct stat *buf)
buf->st_mode |= S_IFDIR;
if (! get_file_attribute (has_acls (), get_win32_name (), &buf->st_mode))
{
+ /* If read-only attribute is set, modify ntsec return value */
+ if (local.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
+ buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
+
buf->st_mode &= ~S_IFMT;
if (get_symlink_p ())
buf->st_mode |= S_IFLNK;