VirtualBox

vbox的更動 36906 路徑 trunk/src/VBox/Runtime/r3/posix


忽略:
時間撮記:
2011-5-1 下午04:35:12 (14 年 以前)
作者:
vboxsync
訊息:

RTPathRename, RTFileRename, RTDirRename / posix: Use stat instead of lstat to check what sources and targets are. Should fix the problem with renaming dangling symlinks.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Runtime/r3/posix/path-posix.cpp

    r34015 r36906  
    336336{
    337337    struct stat SrcStat;
    338     if (stat(pszNativeSrc, &SrcStat))
     338    if (lstat(pszNativeSrc, &SrcStat))
    339339        return false;
    340340    struct stat DstStat;
    341     if (stat(pszNativeDst, &DstStat))
     341    if (lstat(pszNativeDst, &DstStat))
    342342        return false;
    343343    Assert(SrcStat.st_dev && DstStat.st_dev);
     
    381381             * errors from the next step.
    382382             *
    383              * There are race conditions here (perhaps unlikely ones but still), but I'm
     383             * There are race conditions here (perhaps unlikely ones, but still), but I'm
    384384             * afraid there is little with can do to fix that.
    385385             */
    386386            struct stat SrcStat;
    387             if (stat(pszNativeSrc, &SrcStat))
     387            if (lstat(pszNativeSrc, &SrcStat))
    388388                rc = RTErrConvertFromErrno(errno);
    389389            else if (!fFileType)
     
    403403                 */
    404404                struct stat DstStat;
    405                 if (stat(pszNativeDst, &DstStat))
     405                if (lstat(pszNativeDst, &DstStat))
    406406                    rc = errno == ENOENT ? VINF_SUCCESS : RTErrConvertFromErrno(errno);
    407407                else
     
    446446                        else
    447447                        {
    448                             if (stat(pszNativeDst, &DstStat))
     448                            if (lstat(pszNativeDst, &DstStat))
    449449                                rc = errno != ENOENT ? RTErrConvertFromErrno(errno) : VINF_SUCCESS;
    450450                            else if (S_ISDIR(DstStat.st_mode))
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette