diff options
author | Pierre Humblet <phumblet@phumblet.no-ip.org> | 2004-08-14 03:01:21 +0000 |
---|---|---|
committer | Pierre Humblet <phumblet@phumblet.no-ip.org> | 2004-08-14 03:01:21 +0000 |
commit | 252dd88138103396219da5092f1cdb017df0450c (patch) | |
tree | d6fc8ebe4515b7283b66cc3e1ab066df77365027 /winsup/cygwin | |
parent | c355ca594b6a25f93f10702b424e69de0a8f5ff2 (diff) | |
download | newlib-252dd88138103396219da5092f1cdb017df0450c.zip newlib-252dd88138103396219da5092f1cdb017df0450c.tar.gz newlib-252dd88138103396219da5092f1cdb017df0450c.tar.bz2 |
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/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.cc | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 7bb9009..9f9881b 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 57a3c47..5c5095f 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); |