Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2004-08-14 07:01:21 +0400
committerPierre Humblet <phumblet@phumblet.no-ip.org>2004-08-14 07:01:21 +0400
commit252dd88138103396219da5092f1cdb017df0450c (patch)
treed6fc8ebe4515b7283b66cc3e1ab066df77365027 /winsup
parentc355ca594b6a25f93f10702b424e69de0a8f5ff2 (diff)
2004-08-14 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler.cc (fhandler_base::open_9x): Set file attributes for new files.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler.cc11
2 files changed, 13 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7bb900928..9f9881b0b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-14 Pierre Humblet <pierre.humblet@ieee.org>
+
+ * fhandler.cc (fhandler_base::open_9x): Set file attributes
+ for new files.
+
2004-08-11 Christopher Faylor <cgf@timesys.com>
* net.cc (cygwin_gethostbyname): Show failing host name on error.
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 57a3c4712..5c5095f59 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -480,9 +480,14 @@ fhandler_base::open_9x (int flags, mode_t mode)
}
#endif
- /* If mode has no write bits set, we set the R/O attribute. */
- if (!(mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
- file_attributes |= FILE_ATTRIBUTE_READONLY;
+ if (flags & O_CREAT && get_device () == FH_FS)
+ {
+ /* If mode has no write bits set, we set the R/O attribute. */
+ if (!(mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
+ file_attributes |= FILE_ATTRIBUTE_READONLY;
+ /* The file attributes are needed for later use in, e.g. fchmod. */
+ pc.file_attributes (file_attributes & FILE_ATTRIBUTE_VALID_SET_FLAGS);
+ }
x = CreateFile (get_win32_name (), access, shared, &sa, creation_distribution,
file_attributes, 0);