Changeset 25942 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 20, 2010 5:26:22 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56784
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/main.cpp
r25873 r25942 34 34 #include <iprt/initterm.h> 35 35 #include <iprt/path.h> 36 #include <iprt/param.h> 36 37 #include <iprt/stream.h> 37 38 #include <iprt/string.h> … … 50 51 /** The name of our pidfile. It is global for the benefit of the cleanup 51 52 * routine. */ 52 static char *g_pszPidFile;53 static char g_szPidFile[RTPATH_MAX]; 53 54 /** The file handle of our pidfile. It is global for the benefit of the 54 55 * cleanup routine. */ … … 64 65 delete g_pService; 65 66 } 66 if (g_ pszPidFile && g_hPidFile)67 VbglR3ClosePidFile(g_ pszPidFile, g_hPidFile);67 if (g_szPidFile && g_hPidFile) 68 VbglR3ClosePidFile(g_szPidFile, g_hPidFile); 68 69 VbglR3Term(); 69 70 exit(0); … … 230 231 } 231 232 } 232 const char *pszHome = RTEnvGet("HOME"); 233 if (pszHome == NULL) 234 { 235 RTPrintf("VBoxClient: failed to get home directory. Exiting.\n"); 236 Log(("VBoxClient: failed to get home directory. Exiting.\n")); 237 return 1; 238 } 239 if (RTStrAPrintf(&g_pszPidFile, "%s/%s", pszHome, g_pService->getPidFilePath()) == -1) 240 if (pszHome == NULL) 241 { 242 RTPrintf("VBoxClient: out of memory. Exiting.\n"); 243 Log(("VBoxClient: out of memory. Exiting.\n")); 244 return 1; 245 } 233 /** @todo explain why we aren't using RTPathUserHome here so it doesn't get 234 * changed accidentally during some cleanup effort. */ 235 rc = RTEnvGetEx(RTENV_DEFAULT, "HOME", g_szPidFile, sizeof(g_szPidFile), NULL); 236 if (RT_FAILURE(rc)) 237 { 238 RTPrintf("VBoxClient: failed to get home directory, rc=%Rrc. Exiting.\n", rc); 239 Log(("VBoxClient: failed to get home directory, rc=%Rrc. Exiting.\n", rc)); 240 return 1; 241 } 242 rc = RTPathAppend(g_szPidFile, sizeof(g_szPidFile), g_pService->getPidFilePath()); 243 if (RT_FAILURE(rc)) 244 { 245 RTPrintf("VBoxClient: RTPathAppend failed with rc=%Rrc. Exiting.\n", rc); 246 Log(("VBoxClient: RTPathAppend failed with rc=%Rrc. Exiting.\n", rc)); 247 return 1; 248 } 249 246 250 /* Initialise the guest library. */ 247 251 if (RT_FAILURE(VbglR3InitUser())) … … 251 255 return 1; 252 256 } 253 if (g_ pszPidFile && RT_FAILURE(VbglR3PidFile(g_pszPidFile, &g_hPidFile)))257 if (g_szPidFile && RT_FAILURE(VbglR3PidFile(g_szPidFile, &g_hPidFile))) 254 258 { 255 259 RTPrintf("Failed to create a pidfile. Exiting.\n");
Note:
See TracChangeset
for help on using the changeset viewer.