Ignore:
Timestamp:
Nov 2, 2016, 12:28:02 AM (9 years ago)
Author:
bird
Message:

rm.c: Use fts_dirfd on windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/nt/ntunlink.c

    r2985 r2997  
    8383
    8484
    85 static int birdUnlinkInternal(const char *pszFile, int fReadOnlyToo, int fFast)
     85static int birdUnlinkInternal(HANDLE hRoot, const char *pszFile, int fReadOnlyToo, int fFast)
    8686{
    8787    MY_UNICODE_STRING   NtPath;
    8888    int                 rc;
    8989
    90     rc = birdDosToNtPath(pszFile, &NtPath);
     90    if (hRoot == INVALID_HANDLE_VALUE)
     91        hRoot = NULL;
     92    if (hRoot == NULL)
     93        rc = birdDosToNtPath(pszFile, &NtPath);
     94    else
     95        rc = birdDosToRelativeNtPath(pszFile, &NtPath);
    9196    if (rc == 0)
    9297    {
     
    96101            /* This uses FILE_DELETE_ON_CLOSE. Probably only suitable when in a hurry... */
    97102            MY_OBJECT_ATTRIBUTES ObjAttr;
    98             MyInitializeObjectAttributes(&ObjAttr, &NtPath, OBJ_CASE_INSENSITIVE, NULL /*hRoot*/, NULL /*pSecAttr*/);
     103            MyInitializeObjectAttributes(&ObjAttr, &NtPath, OBJ_CASE_INSENSITIVE, hRoot, NULL /*pSecAttr*/);
    99104            rcNt = g_pfnNtDeleteFile(&ObjAttr);
    100105
     
    113118            for (;;)
    114119            {
    115                 rcNt = birdOpenFileUniStr(NULL /*hRoot*/,
     120                rcNt = birdOpenFileUniStr(hRoot,
    116121                                          &NtPath,
    117122                                          DELETE,
     
    157162int birdUnlink(const char *pszFile)
    158163{
    159     return birdUnlinkInternal(pszFile, 0 /*fReadOnlyToo*/, 0 /*fFast*/);
     164    return birdUnlinkInternal(NULL /*hRoot*/, pszFile, 0 /*fReadOnlyToo*/, 0 /*fFast*/);
     165}
     166
     167
     168int birdUnlinkEx(void *hRoot, const char *pszFile)
     169{
     170    return birdUnlinkInternal((HANDLE)hRoot, pszFile, 0 /*fReadOnlyToo*/, 0 /*fFast*/);
    160171}
    161172
     
    163174int birdUnlinkForced(const char *pszFile)
    164175{
    165     return birdUnlinkInternal(pszFile, 1 /*fReadOnlyToo*/, 0 /*fFast*/);
     176    return birdUnlinkInternal(NULL /*hRoot*/, pszFile, 1 /*fReadOnlyToo*/, 0 /*fFast*/);
     177}
     178
     179
     180int birdUnlinkForcedEx(void *hRoot, const char *pszFile)
     181{
     182    return birdUnlinkInternal((HANDLE)hRoot, pszFile, 1 /*fReadOnlyToo*/, 0 /*fFast*/);
    166183}
    167184
     
    169186int birdUnlinkForcedFast(const char *pszFile)
    170187{
    171     return birdUnlinkInternal(pszFile, 1 /*fReadOnlyToo*/, 1 /*fFast*/);
     188    return birdUnlinkInternal(NULL /*hRoot*/, pszFile, 1 /*fReadOnlyToo*/, 1 /*fFast*/);
    172189}
    173190
     191
     192int birdUnlinkForcedFastEx(void *hRoot, const char *pszFile)
     193{
     194    return birdUnlinkInternal((HANDLE)hRoot, pszFile, 1 /*fReadOnlyToo*/, 1 /*fFast*/);
     195}
     196
Note: See TracChangeset for help on using the changeset viewer.