VirtualBox

Changeset 81038 in vbox


Ignore:
Timestamp:
Sep 27, 2019 7:42:28 AM (5 years ago)
Author:
vboxsync
Message:

Additions/VBoxClient: Moved modifying the release logger when running in non-daemonized mode into the generic initialization path of a service.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/main.cpp

    r81028 r81038  
    250250        return RTMsgInitFailure(rc);
    251251
    252     rc = VbglR3InitUser();
    253     if (RT_FAILURE(rc))
    254         return RTMsgErrorExitFailure("VbglR3InitUser failed: %Rrc", rc);
    255 
    256252    /* This should never be called twice in one process - in fact one Display
    257253     * object should probably never be used from multiple threads anyway. */
     
    275271            || !strcmp(argv[i], "--nodaemon"))
    276272        {
    277             /* If the user is running in "no daemon" mode anyway, send critical
    278              * logging to stdout as well. */
    279             PRTLOGGER pReleaseLog = RTLogRelGetDefaultInstance();
    280             if (pReleaseLog)
    281                 rc = RTLogDestinations(pReleaseLog, "stdout");
    282             if (pReleaseLog && RT_FAILURE(rc))
    283                 return RTMsgErrorExitFailure("failed to redivert error output, rc=%Rrc", rc);
    284 
    285273            fDaemonise = false;
    286274            if (   !strcmp(argv[i], "-f")
     
    359347        RTMsgError("No service specified. Quitting because nothing to do!");
    360348        return RTEXITCODE_SYNTAX;
     349    }
     350
     351    /* Initialize VbglR3 before we do anything else with the logger. */
     352    rc = VbglR3InitUser();
     353    if (RT_FAILURE(rc))
     354        VBClFatalError(("VbglR3InitUser failed: %Rrc", rc));
     355
     356    if (!fDaemonise)
     357    {
     358        /* If the user is running in "no daemon" mode, send critical logging to stdout as well. */
     359        PRTLOGGER pReleaseLog = RTLogRelGetDefaultInstance();
     360        if (pReleaseLog)
     361        {
     362            rc = RTLogDestinations(pReleaseLog, "stdout");
     363            if (RT_FAILURE(rc))
     364                return RTMsgErrorExitFailure("Failed to redivert error output, rc=%Rrc", rc);
     365        }
    361366    }
    362367
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