VirtualBox

Changeset 71123 in vbox


Ignore:
Timestamp:
Feb 26, 2018 11:01:04 AM (7 years ago)
Author:
vboxsync
Message:

VBoxService/Toolbox: Dropped building up an internal file list for "vbox_stat".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp

    r71122 r71123  
    13991399    uint32_t fQueryInfoFlags = RTPATH_F_ON_LINK;
    14001400
    1401     /* Init file list. */
    1402     RTLISTANCHOR fileList;
    1403     RTListInit(&fileList);
    1404 
    14051401    while (   (ch = RTGetOpt(&GetState, &ValueUnion))
    14061402           && RT_SUCCESS(rc))
     
    14341430            case VINF_GETOPT_NOT_OPTION:
    14351431            {
    1436 /** @todo r=bird: The whole fileList is unecessary because you're using
    1437  * RTGETOPTINIT_FLAGS_OPTS_FIRST.  You can obviously do the processing right
    1438  * here, but you could also just drop down and rewind GetState.iNext by one and
    1439  * continue there. */
    1440 
    1441                 /* Add file(s) to buffer. This enables processing multiple files
    1442                  * at once.
    1443                  *
    1444                  * Since the non-options (RTGETOPTINIT_FLAGS_OPTS_FIRST) come last when
    1445                  * processing this loop it's safe to immediately exit on syntax errors
    1446                  * or showing the help text (see above). */
    1447                 rc = vgsvcToolboxPathBufAddPathEntry(&fileList, ValueUnion.psz);
     1432                Assert(GetState.iNext);
     1433                GetState.iNext--;
    14481434                break;
    14491435            }
     
    14521438                return RTGetOptPrintError(ch, &ValueUnion);
    14531439        }
     1440
     1441        /* All flags / options processed? Bail out here.
     1442         * Processing the file / directory list comes down below. */
     1443        if (ch == VINF_GETOPT_NOT_OPTION)
     1444            break;
    14541445    }
    14551446
     
    14641455        }
    14651456
    1466         PVBOXSERVICETOOLBOXPATHENTRY pNodeIt;
    1467         RTListForEach(&fileList, pNodeIt, VBOXSERVICETOOLBOXPATHENTRY, Node)
     1457        while ((ch = RTGetOpt(&GetState, &ValueUnion)))
    14681458        {
    14691459            RTFSOBJINFO objInfo;
    1470             int rc2 = RTPathQueryInfoEx(pNodeIt->pszName, &objInfo, RTFSOBJATTRADD_UNIX, fQueryInfoFlags);
     1460            int rc2 = RTPathQueryInfoEx(ValueUnion.psz, &objInfo, RTFSOBJATTRADD_UNIX, fQueryInfoFlags);
    14711461            if (RT_FAILURE(rc2))
    14721462            {
    14731463                if (!(fOutputFlags & VBOXSERVICETOOLBOXOUTPUTFLAG_PARSEABLE))
    1474                     RTMsgError("Cannot stat for '%s': %Rrc\n", pNodeIt->pszName, rc2);
     1464                    RTMsgError("Cannot stat for '%s': %Rrc\n", ValueUnion.psz, rc2);
    14751465            }
    14761466            else
    14771467            {
    1478                 rc2 = vgsvcToolboxPrintFsInfo(pNodeIt->pszName,
    1479                                               strlen(pNodeIt->pszName) /* cbName */,
     1468                rc2 = vgsvcToolboxPrintFsInfo(ValueUnion.psz,
     1469                                              strlen(ValueUnion.psz) /* cbName */,
    14801470                                              fOutputFlags,
    14811471                                              &objInfo);
     
    14921482
    14931483        /* At this point the overall result (success/failure) should be in rc. */
    1494 
    1495         if (RTListIsEmpty(&fileList))
    1496             RTMsgError("Missing operand\n");
    14971484    }
    14981485    else
    14991486        RTMsgError("Failed with rc=%Rrc\n", rc);
    1500 
    1501     vgsvcToolboxPathBufDestroy(&fileList);
    15021487
    15031488    if (RT_FAILURE(rc))
Note: See TracChangeset for help on using the changeset viewer.

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