Changeset 1778


Ignore:
Timestamp:
Jan 17, 2005, 4:25:13 AM (21 years ago)
Author:
bird
Message:

rmdir shall fail on symlink. It shall return ENOTDIR if the path exist and isn't a dir.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/sys/b_fsDirRemove.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1777 r1778  
    3535#include "b_fs.h"
    3636#include <errno.h>
     37#include <sys/stat.h>
    3738#include <InnoTekLIBC/backend.h>
    3839#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
     
    5455    /*
    5556     * Resolve the path.
     57     * (Symlinks should cause failure, so don't resolve last component.)
    5658     */
    5759    char szNativePath[PATH_MAX];
    58     int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL);
     60    int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_PARENT | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL);
    5961    if (rc)
    6062        LIBCLOG_RETURN_INT(rc);
     
    6971    {
    7072        /*
    71          * OS/2 returns access denied when the directory contains files.
     73         * OS/2 returns access denied when the directory
     74         * contains files or it is not a directory. Check for
     75         * directory/other and return failure accordingly.
    7276         */
    7377        if (rc == ERROR_ACCESS_DENIED)
    74             rc = -ENOTEMPTY;
     78        {
     79            struct stat s;
     80            rc = __libc_back_fsNativeFileStat(&szNativePath[0], &s);
     81            if (!rc)
     82                rc = S_ISDIR(s.st_mode) ? -ENOTEMPTY : -ENOTDIR;
     83        }
    7584        else
    7685            rc = -__libc_native2errno(rc);
Note: See TracChangeset for help on using the changeset viewer.