Changeset 57729 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Sep 14, 2015 8:12:50 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r57721 r57729 289 289 { 290 290 RTLogDestroy(RTLogRelSetDefaultInstance(NULL)); 291 }292 293 /*294 * Create the PID file.295 */296 int vboxServiceCreatePidFile(const char *pszPidFile)297 {298 RTFILE hFile;299 int rc = RTFileOpen(&hFile, pszPidFile, RTFILE_O_WRITE | RTFILE_O_TRUNCATE);300 if (RT_SUCCESS(rc))301 {302 char szPid[32];303 RTPROCESS Process = RTProcSelf();304 size_t cb = RTStrPrintf(szPid, sizeof(szPid), "%RU64\n", (uint64_t)Process);305 rc = RTFileWrite(hFile, szPid, cb, NULL);306 int rc2 = RTFileClose(hFile);307 if (RT_SUCCESS(rc))308 rc = rc2;309 }310 if (RT_FAILURE(rc))311 VBoxServiceError("Failed to create PID file: %Rrc\n", rc);312 return rc;313 291 } 314 292 … … 1161 1139 #endif /* RT_OS_WINDOWS */ 1162 1140 rc = VBoxServiceStartServices(); 1141 RTFILE hPidFile = NIL_RTFILE; 1163 1142 if (RT_SUCCESS(rc)) 1164 { 1165 if (strlen(g_szPidFile)) 1166 rc = vboxServiceCreatePidFile(g_szPidFile); 1167 } 1143 if (g_szPidFile[0]) 1144 rc = VbglR3PidFile(g_szPidFile, &hPidFile); 1168 1145 rcExit = RT_SUCCESS(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 1169 1146 if (RT_SUCCESS(rc)) 1170 1147 VBoxServiceMainWait(); 1148 if (g_szPidFile[0] && hPidFile != NIL_RTFILE) 1149 VbglR3ClosePidFile(g_szPidFile, hPidFile); 1171 1150 #ifdef RT_OS_WINDOWS 1172 1151 # ifndef RT_OS_NT4
Note:
See TracChangeset
for help on using the changeset viewer.