Quoting from the man page for stat(2) on Linux:

   Unix V7 (and later systems) had S_IREAD, S_IWRITE, S_IEXEC, where POSIX
   prescribes the synonyms S_IRUSR, S_IWUSR, S_IXUSR.

This patch makes this simple substitution so that the code compiles
with recent glibc.  (The patch also applies correctly to 2010.1.16).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
--- ntfs-3g-2009.11.14.orig/libntfs-3g/security.c       2009-11-05 
11:43:36.000000000 +0000
+++ ntfs-3g-2009.11.14/libntfs-3g/security.c    2010-01-27 11:26:10.337203499 
+0000
@@ -3265,7 +3265,7 @@
  *
  *     Returns 1 if access is allowed, including user is root or no
  *               user mapping defined
- *             2 if sticky and accesstype is S_IWRITE + S_IEXEC + S_ISVTX
+ *             2 if sticky and accesstype is S_IWUSR + S_IXUSR + S_ISVTX
  *             0 and sets errno if there is a problem or if access
  *               is not allowed
  *
@@ -3292,7 +3292,7 @@
         */
        if (!scx->mapping[MAPUSERS]
            || (!scx->uid
-               && (!(accesstype & S_IEXEC)
+               && (!(accesstype & S_IXUSR)
                    || (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY))))
                allow = 1;
        else {
@@ -3300,28 +3300,28 @@
                if (perm >= 0) {
                        res = EACCES;
                        switch (accesstype) {
-                       case S_IEXEC:
+                       case S_IXUSR:
                                allow = (perm & (S_IXUSR | S_IXGRP | S_IXOTH)) 
!= 0;
                                break;
-                       case S_IWRITE:
+                       case S_IWUSR:
                                allow = (perm & (S_IWUSR | S_IWGRP | S_IWOTH)) 
!= 0;
                                break;
-                       case S_IWRITE + S_IEXEC:
+                       case S_IWUSR + S_IXUSR:
                                allow = ((perm & (S_IWUSR | S_IWGRP | S_IWOTH)) 
!= 0)
                                    && ((perm & (S_IXUSR | S_IXGRP | S_IXOTH)) 
!= 0);
                                break;
-                       case S_IREAD:
+                       case S_IRUSR:
                                allow = (perm & (S_IRUSR | S_IRGRP | S_IROTH)) 
!= 0;
                                break;
-                       case S_IREAD + S_IEXEC:
+                       case S_IRUSR + S_IXUSR:
                                allow = ((perm & (S_IRUSR | S_IRGRP | S_IROTH)) 
!= 0)
                                    && ((perm & (S_IXUSR | S_IXGRP | S_IXOTH)) 
!= 0);
                                break;
-                       case S_IREAD + S_IWRITE:
+                       case S_IRUSR + S_IWUSR:
                                allow = ((perm & (S_IRUSR | S_IRGRP | S_IROTH)) 
!= 0)
                                    && ((perm & (S_IWUSR | S_IWGRP | S_IWOTH)) 
!= 0);
                                break;
-                       case S_IWRITE + S_IEXEC + S_ISVTX:
+                       case S_IWUSR + S_IXUSR + S_ISVTX:
                                if (perm & S_ISVTX) {
                                        if 
((ntfs_get_owner_mode(scx,path,ni,&stbuf) >= 0)
                                            && (stbuf.st_uid == scx->uid))
@@ -3387,7 +3387,7 @@
                                 * for an not-owned sticky directory, have to
                                 * check whether file itself is owned
                                 */
-                       if ((accesstype == (S_IWRITE + S_IEXEC + S_ISVTX))
+                       if ((accesstype == (S_IWUSR + S_IXUSR + S_ISVTX))
                           && (allow == 2)) {
                                ni = ntfs_pathname_to_inode(scx->vol, NULL,
                                         path);
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to