VirtualBox

Changeset 35617 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 18, 2011 2:55:39 PM (14 years ago)
Author:
vboxsync
Message:

Additions/x11/VBoxClient: daemonise later so that we get error messages if something goes wrong

File:
1 edited

Legend:

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

    r32845 r35617  
    239239        exit(1);
    240240    }
     241    /* Get the path for the pidfiles */
     242    rc = RTPathUserHome(g_szPidFile, sizeof(g_szPidFile));
     243    if (RT_FAILURE(rc))
     244    {
     245        RTPrintf("VBoxClient: failed to get home directory, rc=%Rrc.  Exiting.\n", rc);
     246        LogRel(("VBoxClient: failed to get home directory, rc=%Rrc.  Exiting.\n", rc));
     247        return 1;
     248    }
     249    rc = RTPathAppend(g_szPidFile, sizeof(g_szPidFile), g_pService->getPidFilePath());
     250    if (RT_FAILURE(rc))
     251    {
     252        RTPrintf("VBoxClient: RTPathAppend failed with rc=%Rrc.  Exiting.\n", rc);
     253        LogRel(("VBoxClient: RTPathAppend failed with rc=%Rrc.  Exiting.\n", rc));
     254        return 1;
     255    }
     256
     257    /* Initialise the guest library. */
     258    if (RT_FAILURE(VbglR3InitUser()))
     259    {
     260        RTPrintf("Failed to connect to the VirtualBox kernel service\n");
     261        LogRel(("Failed to connect to the VirtualBox kernel service\n"));
     262        return 1;
     263    }
     264    if (g_szPidFile[0] && RT_FAILURE(VbglR3PidFile(g_szPidFile, &g_hPidFile)))
     265    {
     266        RTPrintf("Failed to create a pidfile.  Exiting.\n");
     267        LogRel(("Failed to create a pidfile.  Exiting.\n"));
     268        VbglR3Term();
     269        return 1;
     270    }
    241271    if (fDaemonise)
    242272    {
     
    251281            return 1;
    252282        }
    253     }
    254     /** @todo explain why we aren't using RTPathUserHome here so it doesn't get
    255      *        changed accidentally during some cleanup effort. */
    256     rc = RTEnvGetEx(RTENV_DEFAULT, "HOME", g_szPidFile, sizeof(g_szPidFile), NULL);
    257     if (RT_FAILURE(rc))
    258     {
    259         RTPrintf("VBoxClient: failed to get home directory, rc=%Rrc.  Exiting.\n", rc);
    260         LogRel(("VBoxClient: failed to get home directory, rc=%Rrc.  Exiting.\n", rc));
    261         return 1;
    262     }
    263     rc = RTPathAppend(g_szPidFile, sizeof(g_szPidFile), g_pService->getPidFilePath());
    264     if (RT_FAILURE(rc))
    265     {
    266         RTPrintf("VBoxClient: RTPathAppend failed with rc=%Rrc.  Exiting.\n", rc);
    267         LogRel(("VBoxClient: RTPathAppend failed with rc=%Rrc.  Exiting.\n", rc));
    268         return 1;
    269     }
    270 
    271     /* Initialise the guest library. */
    272     if (RT_FAILURE(VbglR3InitUser()))
    273     {
    274         RTPrintf("Failed to connect to the VirtualBox kernel service\n");
    275         LogRel(("Failed to connect to the VirtualBox kernel service\n"));
    276         return 1;
    277     }
    278     if (g_szPidFile[0] && RT_FAILURE(VbglR3PidFile(g_szPidFile, &g_hPidFile)))
    279     {
    280         RTPrintf("Failed to create a pidfile.  Exiting.\n");
    281         LogRel(("Failed to create a pidfile.  Exiting.\n"));
    282         VbglR3Term();
    283         return 1;
    284283    }
    285284    /* Set signal handlers to clean up on exit. */
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