This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch]: Re: CVS commit under windows 98


A feature present in open was missing from open9x.

Pierre

2004-08-14  Pierre Humblet <pierre.humblet@ieee.org>

	* fhandler.cc (fhandler_base::open_9x): Set file attributes
	for new files.


Index: fhandler.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler.cc,v
retrieving revision 1.201
diff -u -p -r1.201 fhandler.cc
--- fhandler.cc 17 Jun 2004 15:25:09 -0000      1.201
+++ fhandler.cc 13 Aug 2004 23:12:42 -0000
@@ -480,9 +480,14 @@ fhandler_base::open_9x (int flags, 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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]