Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com Message-ID: <38669C7E.12BC46F0@vinschen.de> Date: Sun, 26 Dec 1999 23:53:50 +0100 From: Corinna Vinschen X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: de,en MIME-Version: 1.0 To: Chris Faylor CC: cygdev Subject: Patch: access Content-Type: multipart/mixed; boundary="------------2FF0231965E8103CD4E126C5" 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 * 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--