VirtualBox

vbox的更動 60980 路徑 trunk/src/VBox/Additions


忽略:
時間撮記:
2016-5-13 下午05:08:19 (9 年 以前)
作者:
vboxsync
訊息:

Additions/VBoxClient: Only run service if initialization was successful, use proper RTEXITODE exit codes.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Additions/x11/VBoxClient/main.cpp

    r58993 r60980  
    270270        {
    271271            vboxClientUsage(pcszFileName);
    272             return 0;
     272            return RTEXITCODE_SUCCESS;
    273273        }
    274274        else if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version"))
    275275        {
    276276            RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr());
    277             return 0;
     277            return RTEXITCODE_SUCCESS;
    278278        }
    279279        else
     
    281281            RTPrintf("%s: unrecognized option `%s'\n", pcszFileName, argv[i]);
    282282            RTPrintf("Try `%s --help' for more information\n", pcszFileName);
    283             return 1;
     283            return RTEXITCODE_SYNTAX;
    284284        }
    285285        rc = VINF_SUCCESS;
     
    288288    {
    289289        vboxClientUsage(pcszFileName);
    290         return 1;
     290        return RTEXITCODE_SYNTAX;
    291291    }
    292292
    293293    rc = RTCritSectInit(&g_critSect);
    294294    if (RT_FAILURE(rc))
    295         VBClFatalError(("Initialising critical section: %Rrc\n", rc));
     295        VBClFatalError(("Initialising critical section failed: %Rrc\n", rc));
    296296    if ((*g_pService)->getPidFilePath)
    297297    {
    298298        rc = RTPathUserHome(g_szPidFile, sizeof(g_szPidFile));
    299299        if (RT_FAILURE(rc))
    300             VBClFatalError(("Getting home directory for pid-file: %Rrc\n", rc));
     300            VBClFatalError(("Getting home directory for PID file failed: %Rrc\n", rc));
    301301        rc = RTPathAppend(g_szPidFile, sizeof(g_szPidFile),
    302302                          (*g_pService)->getPidFilePath());
    303303        if (RT_FAILURE(rc))
    304             VBClFatalError(("Creating pid-file path: %Rrc\n", rc));
     304            VBClFatalError(("Creating PID file path failed: %Rrc\n", rc));
    305305        if (fDaemonise)
    306306            rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */, fRespawn, &cRespawn);
    307307        if (RT_FAILURE(rc))
    308             VBClFatalError(("Daemonizing: %Rrc\n", rc));
     308            VBClFatalError(("Daemonizing failed: %Rrc\n", rc));
    309309        if (g_szPidFile[0])
    310310            rc = VbglR3PidFile(g_szPidFile, &g_hPidFile);
    311311        if (rc == VERR_FILE_LOCK_VIOLATION)  /* Already running. */
    312             return 0;
    313         if (RT_FAILURE(rc))
    314             VBClFatalError(("Creating pid-file: %Rrc\n", rc));
     312            return RTEXITCODE_SUCCESS;
     313        if (RT_FAILURE(rc))
     314            VBClFatalError(("Creating PID file failed: %Rrc\n", rc));
    315315    }
    316316    /* Set signal handlers to clean up on exit. */
     
    325325#endif
    326326    rc = (*g_pService)->init(g_pService);
    327     if (RT_FAILURE(rc))
    328         VBClFatalError(("Initialising service: %Rrc\n", rc));
    329     rc = (*g_pService)->run(g_pService, fDaemonise);
    330     if (RT_FAILURE(rc))
    331         VBClFatalError(("Service main loop failed: %Rrc\n", rc));
     327    if (RT_SUCCESS(rc))
     328    {
     329        rc = (*g_pService)->run(g_pService, fDaemonise);
     330        if (RT_FAILURE(rc))
     331            LogRel2(("Running service failed: %Rrc\n", rc));
     332    }
     333    else
     334    {
     335        /** @todo r=andy Should we return an appropriate exit code if the service failed to init?
     336         *               Must be tested carefully with our init scripts first. */
     337        LogRel2(("Initializing service failed: %Rrc\n", rc));
     338    }
    332339    VBClCleanUp();
    333     return 0;
    334 }
     340    return RTEXITCODE_SUCCESS;
     341}
     342
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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