Mail Archives: cygwin-developers/1999/12/26/17:55:19
This is a multi-part message in MIME format.
--------------2FF0231965E8103CD4E126C5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
And then there were three... patches.
I have patched access(2) to provide exacter results.
Bye,
Corinna
ChangeLog:
==========
Sun Dec 26 23:47:00 1999 Corinna Vinschen <corinna AT vinschen DOT de>
* syscalls.cc (access): Refined implementation.
--------------2FF0231965E8103CD4E126C5
Content-Type: text/plain; charset=us-ascii;
name="access-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="access-patch"
--- syscalls.cc.orig Sun Dec 26 23:38:02 1999
+++ syscalls.cc Sun Dec 26 23:37:38 1999
@@ -1027,6 +1027,7 @@ access (const char *fn, int flags)
r = stat (fn, &st);
if (r)
return -1;
+#if 0
if (flags & W_OK)
{
if (st.st_mode & S_IWRITE)
@@ -1036,6 +1037,53 @@ access (const char *fn, int flags)
set_errno (EACCES);
return -1;
}
+#else
+ if (flags & R_OK)
+ {
+ if (st.st_uid == myself->uid)
+ {
+ if (!(st.st_mode & S_IRUSR))
+ return -1;
+ }
+ else if (st.st_gid == myself->gid)
+ {
+ if (!(st.st_mode & S_IRGRP))
+ return -1;
+ }
+ else if (!(st.st_mode & S_IROTH))
+ return -1;
+ }
+ if (flags & W_OK)
+ {
+ if (st.st_uid == myself->uid)
+ {
+ if (!(st.st_mode & S_IWUSR))
+ return -1;
+ }
+ else if (st.st_gid == myself->gid)
+ {
+ if (!(st.st_mode & S_IWGRP))
+ return -1;
+ }
+ else if (!(st.st_mode & S_IWOTH))
+ return -1;
+ }
+ if (flags & X_OK)
+ {
+ if (st.st_uid == myself->uid)
+ {
+ if (!(st.st_mode & S_IXUSR))
+ return -1;
+ }
+ else if (st.st_gid == myself->gid)
+ {
+ if (!(st.st_mode & S_IXGRP))
+ return -1;
+ }
+ else if (!(st.st_mode & S_IXOTH))
+ return -1;
+ }
+#endif
return 0;
}
--------------2FF0231965E8103CD4E126C5--
- Raw text -