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.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 510c7250d..9a177bd6e 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -371,6 +371,15 @@ fhandler_base::open (path_conv *, int flags, mode_t mode)
if (get_device () == FH_SERIAL)
file_attributes |= FILE_FLAG_OVERLAPPED;
+#ifdef HIDDEN_DOT_FILES
+ if (flags & O_CREAT && get_device () == FH_DISK)
+ {
+ char *c = strrchr (get_win32_name (), '\\');
+ if ((c && c[1] == '.') || *get_win32_name () == '.')
+ file_attributes |= FILE_ATTRIBUTE_HIDDEN;
+ }
+#endif
+
/* CreateFile() with dwDesiredAccess == 0 when called on remote
share returns some handle, even if file doesn't exist. This code
works around this bug. */