Changeset 3777


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.

Files:
4 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))
  • 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.