delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/12/26/17:55:19

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
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 <corinna AT vinschen DOT de>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: Chris Faylor <cgf AT cygnus DOT com>
CC: cygdev <cygwin-developers AT sourceware DOT cygnus DOT com>
Subject: Patch: access

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019