Changeset 3777 for branches


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:
branches/libc-0.6/src/emx/src/lib/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/lib/sys/b_fsFileModeSetFH.c

    r2525 r3777  
    127127            mode_t CurMode;
    128128            rc = __libc_back_fsUnixAttribsGetMode(fh, pFH->pszNativePath, &CurMode);
    129             if (__predict_true(!rc))
     129            if (__predict_true(!rc || rc == -ENOTSUP))
    130130            {
    131131                /* correct the passed in Mode mask. */
    132132                Mode &= ALLPERMS; /** @todo sticky bit and set uid/gid access validation... */
    133                 Mode |= CurMode & ~ALLPERMS;
     133                if (!(CurMode & ~ALLPERMS))
     134                    Mode |= S_IFREG;
     135                else
     136                    Mode |= CurMode & ~ALLPERMS;
    134137
    135138                /* construct FEA2 stuff. */
     
    174177                }
    175178            }
    176             else if (rc == -ENOTSUP)
    177                 rc = 0;
    178179
    179180            if (__predict_false(rc != 0))
  • branches/libc-0.6/src/emx/src/lib/sys/b_fsNativeFileModeSet.c

    r2531 r3777  
    161161        mode_t CurMode;
    162162        rc = __libc_back_fsUnixAttribsGetMode(-1, pszNativePath, &CurMode);
    163         if (__predict_true(!rc))
     163        if (__predict_true(!rc || rc == -ENOTSUP))
    164164        {
    165165            /* correct the passed in Mode mask. */
    166166            Mode &= ALLPERMS; /** @todo sticky bit and set uid/gid access validation... */
    167             Mode |= CurMode & ~ALLPERMS;
     167            if (!(CurMode & ~ALLPERMS))
     168            {
     169#if OFF_MAX > LONG_MAX
     170                if ((fLarge ? info.fsts4L.attrFile : info.fsts4.attrFile) & FILE_DIRECTORY)
     171#else
     172                if (info.fsts4.attrFile & FILE_DIRECTORY)
     173#endif
     174                    Mode |= S_IFDIR;
     175                else
     176                    Mode |= S_IFREG;
     177            }
     178            else
     179                Mode |= CurMode & ~ALLPERMS;
    168180
    169181            /* construct FEA2 stuff. */
     
    201213            }
    202214        }
    203         else if (rc == -ENOTSUP)
    204             rc = 0;
    205215
    206216        if (__predict_false(rc != 0))
Note: See TracChangeset for help on using the changeset viewer.