Changeset 3777 for trunk


Ignore:
Timestamp:
Mar 22, 2012, 2:01:57 PM (13 years ago)
Author:
bird
Message:

chmod/fchmod: Add unix mode EA if not found and the FS supports it. Fixes #205.

Location:
trunk/libc/src/kNIX/os2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/src/kNIX/os2/b_fsNativeFileModeSet.c

    r2929 r3777  
    144144        mode_t CurMode;
    145145        rc = __libc_back_fsUnixAttribsGetMode(-1, pszNativePath, &CurMode);
    146         if (__predict_true(!rc))
     146        if (__predict_true(!rc || rc == -ENOTSUP))
    147147        {
    148148            /* correct the passed in Mode mask. */
    149149            Mode &= ALLPERMS; /** @todo sticky bit and set uid/gid access validation... */
    150             Mode |= CurMode & ~ALLPERMS;
     150            if (!(CurMode & ~ALLPERMS))
     151            {
     152#if OFF_MAX > LONG_MAX
     153                if ((fLarge ? info.fsts4L.attrFile : info.fsts4.attrFile) & FILE_DIRECTORY)
     154#else
     155                if (info.fsts4.attrFile & FILE_DIRECTORY)
     156#endif
     157                    Mode |= S_IFDIR;
     158                else
     159                    Mode |= S_IFREG;
     160            }
     161            else
     162                Mode |= CurMode & ~ALLPERMS;
    151163
    152164            /* construct FEA2 stuff. */
     
    184196            }
    185197        }
    186         else if (rc == -ENOTSUP)
    187             rc = 0;
    188 
    189198        if (__predict_false(rc != 0))
    190199        {
  • trunk/libc/src/kNIX/os2/fhOS2File.c

    r3776 r3777  
    608608            mode_t fCurMode;
    609609            rc = __libc_back_fsUnixAttribsGetMode(pFH->fh, pFH->pszNativePath, &fCurMode);
    610             if (__predict_true(!rc))
     610            if (__predict_true(!rc || rc == -ENOTSUP))
    611611            {
    612612                /* correct the passed in Mode mask. */
    613613                fMode &= ALLPERMS; /** @todo sticky bit and set uid/gid access validation... */
    614                 fMode |= fCurMode & ~ALLPERMS;
     614                if (!(fCurMode & ~ALLPERMS))
     615                    fMode |= S_IFREG;
     616                else
     617                    fMode |= fCurMode & ~ALLPERMS;
    615618
    616619                /* construct FEA2 stuff. */
     
    653656                }
    654657            }
    655             else if (rc == -ENOTSUP)
    656                 rc = 0;
    657658        }
    658659        if (!rc)
Note: See TracChangeset for help on using the changeset viewer.