Changeset 2543 for branches/libc-0.6


Ignore:
Timestamp:
Feb 7, 2006, 4:10:33 AM (20 years ago)
Author:
bird
Message:

#52: Fixed two 'symlink/' problems in the path resolver.

Location:
branches/libc-0.6/src/emx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/ChangeLog.LIBC

    r2539 r2543  
    552006-02-06: knut st. osmundsen <bird-gccos2-spam@anduin.net>
    66    - libc:
     7        o #52: Fixed two 'symlink/' problems in the path resolver.
     8        o #51: Made unlink able to delete readonly files.
    79        o #50: Inherit umask.
    810        o #30: Committed forgotten header.
  • branches/libc-0.6/src/emx/src/lib/sys/fs.c

    r2538 r2543  
    499499}
    500500
     501
     502/**
     503 * Checks if the specified path is a symlink or not.
     504 * @returns true / false.
     505 * @param   pszNativePath       Path to the potential symlink.
     506 */
     507static int fsIsSymlink(const char *pszNativePath)
     508{
     509    char sz[16];
     510    return __libc_back_fsNativeSymlinkRead(pszNativePath, sz, sizeof(sz)) >= 0;
     511}
     512
     513
    501514#if 0 //just testing, not useful.
    502515/**
     
    622635    /*
    623636     * Remove trailing slash if the path may be pointing to a directory.
     637     * A symlink search is converted to a directory search if this is encountered.
    624638     */
    625639    int cch = pszTrg - pszPath;
    626     if (    (fFlags & BACKFS_FLAGS_RESOLVE_DIR)
     640    if (    (fFlags & (BACKFS_FLAGS_RESOLVE_DIR | BACKFS_FLAGS_RESOLVE_FULL_SYMLINK))
    627641        &&  cch > 1
    628642        &&  pszTrg[-1] == '/'
     
    632646        pszPath[--cch] = '\0';
    633647        if (pfFlags)
    634             *pfFlags &= ~BACKFS_FLAGS_RESOLVE_DIR_MAYBE_;
     648        {
     649            *pfFlags &= ~(BACKFS_FLAGS_RESOLVE_DIR_MAYBE_ | BACKFS_FLAGS_RESOLVE_FULL_SYMLINK);
     650            if (fFlags & BACKFS_FLAGS_RESOLVE_FULL_SYMLINK)
     651                *pfFlags |= BACKFS_FLAGS_RESOLVE_DIR | BACKFS_FLAGS_RESOLVE_FULL;
     652        }
    635653    }
    636654
     
    10861104                &&  (   (fFlags & BACKFS_FLAGS_RESOLVE_FULL)
    10871105                     || chSlash)
    1088                 &&  !(pFindBuf4->attrFile & FILE_DIRECTORY))
     1106                &&  !fIsDirectory)
    10891107            {
    10901108                PEAOP2  pEaOp2 = (PEAOP2)pachBuffer;
     
    12291247                rcRet = 0;
    12301248                if (    (fFlags & (BACKFS_FLAGS_RESOLVE_DIR | BACKFS_FLAGS_RESOLVE_DIR_MAYBE_)) == BACKFS_FLAGS_RESOLVE_DIR
    1231                     &&  !fIsDirectory)
     1249                    &&  !fIsDirectory
     1250                    &&  (     !fUnixEAs
     1251                         ||    pFindBuf4->cbList <= sizeof(USHORT) * 2 + 1
     1252                         ||   !fsIsSymlink(pszNativePath)))
    12321253                    rcRet = -ENOTDIR;
    12331254                break;
Note: See TracChangeset for help on using the changeset viewer.