Changeset 37356 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jun 7, 2011 5:04:39 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r37179 r37356 713 713 } 714 714 715 static nsresult vboxsvcSpawnDaemonByReExec(const char *pszPath )715 static nsresult vboxsvcSpawnDaemonByReExec(const char *pszPath, bool fAutoShutdown, const char *pszPidFile) 716 716 { 717 717 PRFileDesc *readable = nsnull, *writable = nsnull; … … 719 719 nsresult rv = NS_ERROR_FAILURE; 720 720 PRFileDesc *devNull; 721 unsigned args_index = 0; 721 722 // The ugly casts are necessary because the PR_CreateProcessDetached has 722 723 // a const array of writable strings as a parameter. It won't write. */ 723 char * const args[] = { (char *)pszPath, (char *)"--auto-shutdown", 0 }; 724 char * args[1 + 1 + 2 + 1]; 725 args[args_index++] = (char *)pszPath; 726 if (fAutoShutdown) 727 args[args_index++] = (char *)"--auto-shutdown"; 728 if (pszPidFile) 729 { 730 args[args_index++] = (char *)"--pidfile"; 731 args[args_index++] = (char *)pszPidFile; 732 } 733 args[args_index++] = 0; 724 734 725 735 // Use a pipe to determine when the daemon process is in the position … … 744 754 PR_ProcessAttrSetStdioRedirect(attr, PR_StandardError, devNull); 745 755 746 if (PR_CreateProcessDetached(pszPath, args, nsnull, attr) != PR_SUCCESS)756 if (PR_CreateProcessDetached(pszPath, (char * const *)args, nsnull, attr) != PR_SUCCESS) 747 757 goto end; 748 758 … … 848 858 if (fDaemonize) 849 859 { 850 vboxsvcSpawnDaemonByReExec(argv[0] );860 vboxsvcSpawnDaemonByReExec(argv[0], gAutoShutdown, g_pszPidFile); 851 861 exit(126); 852 862 }
Note:
See TracChangeset
for help on using the changeset viewer.