VirtualBox

Changeset 44231 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Jan 4, 2013 2:06:39 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83065
Message:

dir-win.cpp: supposed to return success even if no matches were found, that's what tstDir-3 checks for and we do on linux+the-rest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/dir-win.cpp

    r39627 r44231  
    139139     * it when adding the wildcard expression.
    140140     */
    141     size_t cchExpr;
     141    size_t cbExpr;
    142142    const char *pszExpr;
    143143    if (pDir->enmFilter == RTDIRFILTER_WINNT)
    144144    {
    145145        pszExpr = pDir->pszFilter;
    146         cchExpr = pDir->cchFilter + 1;
     146        cbExpr = pDir->cchFilter + 1;
    147147    }
    148148    else
    149149    {
    150150        pszExpr = "*";
    151         cchExpr = sizeof("*");
    152     }
    153     if (pDir->cchPath + cchExpr > RTPATH_MAX)
     151        cbExpr = sizeof("*");
     152    }
     153    if (pDir->cchPath + cbExpr > RTPATH_MAX)
    154154        return VERR_FILENAME_TOO_LONG;
    155     memcpy(pszPathBuf + pDir->cchPath, pszExpr, cchExpr);
     155    memcpy(pszPathBuf + pDir->cchPath, pszExpr, cbExpr);
    156156
    157157
     
    167167        if (pDir->hDir != INVALID_HANDLE_VALUE)
    168168            pDir->fDataUnread = true;
    169         /* theoretical case of an empty directory. */
    170         else if (GetLastError() == ERROR_NO_MORE_FILES)
    171             pDir->fDataUnread = false;
    172169        else
    173             rc = RTErrConvertFromWin32(GetLastError());
     170        {
     171            DWORD dwErr = GetLastError();
     172            /* Theoretical case of an empty directory or more normal case of no matches. */
     173            if (   dwErr == ERROR_FILE_NOT_FOUND
     174                || dwErr == ERROR_NO_MORE_FILES /* ???*/)
     175                pDir->fDataUnread = false;
     176            else
     177                rc = RTErrConvertFromWin32(GetLastError());
     178        }
    174179        RTUtf16Free(pwszName);
    175180    }
Note: See TracChangeset for help on using the changeset viewer.

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