VirtualBox

Ignore:
Timestamp:
Oct 11, 2010 4:30:54 PM (14 years ago)
Author:
vboxsync
Message:

iprt/process: eliminate RTPROC_FLAGS_DAEMONIZE_DEPRECATED, rework starting a detached process on posix platforms and eliminate one useless fork(), avoid running

atexit functions in the temporary process

XPCOM: more detached process rework, block anything not going through IPRT, clos
e a few file descriptor inheritance leaks, and clean up the file descriptor pass
ing to VBoxXPCOMIPCD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/client/src/ipcdclient.cpp

    r30514 r33044  
    12161216  PRProcessAttr *attr = nsnull;
    12171217  nsresult rv = NS_ERROR_FAILURE;
     1218  PRFileDesc *devNull;
    12181219  char *const argv[] = { (char *const) path, nsnull };
    12191220  char c;
     
    12331234
    12341235  if (PR_ProcessAttrSetInheritableFD(attr, writable, IPC_STARTUP_PIPE_NAME) != PR_SUCCESS)
     1236  goto end;
     1237
     1238  devNull = PR_Open("/dev/null", PR_RDWR, 0);
     1239  if (!devNull)
    12351240    goto end;
     1241
     1242  PR_ProcessAttrSetStdioRedirect(attr, PR_StandardInput, devNull);
     1243  PR_ProcessAttrSetStdioRedirect(attr, PR_StandardOutput, devNull);
     1244  PR_ProcessAttrSetStdioRedirect(attr, PR_StandardError, devNull);
    12361245
    12371246  if (PR_CreateProcessDetached(path, argv, nsnull, attr) != PR_SUCCESS)
    12381247    goto end;
    12391248
     1249  // Close /dev/null
     1250  PR_Close(devNull);
    12401251  // close the child end of the pipe in order to get notification on unexpected
    12411252  // child termination instead of being infinitely blocked in PR_Read().
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