VirtualBox

Changeset 42995 in vbox


Ignore:
Timestamp:
Aug 27, 2012 11:41:36 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80327
Message:

VBoxServiceToolBox.cpp/cat: Fixed bug in --output handling. The output string was passed as the format string to a RTStrPrintf call. Fortuantely, the RTStrPrintf call and extra buffering is completely unnecessary. Replaced szOutput+RTStrPrintf by a pszOutput.

File:
1 edited

Legend:

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

    r42764 r42995  
    367367    bool fUsageOK = true;
    368368
    369     char szOutput[RTPATH_MAX] = { 0 };
     369    const char *pszOutput = NULL;
    370370    RTFILE hOutput = NIL_RTFILE;
    371371    uint32_t fFlags = RTFILE_O_CREATE_REPLACE /* Output file flags. */
     
    403403
    404404            case 'o':
    405                 if (!RTStrPrintf(szOutput, sizeof(szOutput), ValueUnion.psz))
    406                     rc = VERR_NO_MEMORY;
     405                pszOutput = ValueUnion.psz;
    407406                break;
    408407
     
    438437    if (RT_SUCCESS(rc))
    439438    {
    440         if (strlen(szOutput))
    441         {
    442             rc = RTFileOpen(&hOutput, szOutput, fFlags);
     439        if (pszOutput)
     440        {
     441            rc = RTFileOpen(&hOutput, pszOutput, fFlags);
    443442            if (RT_FAILURE(rc))
    444443                RTMsgError("Could not create output file '%s', rc=%Rrc\n",
    445                            szOutput, rc);
     444                           pszOutput, rc);
    446445        }
    447446
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