VirtualBox

Changeset 44555 in vbox for trunk/src/VBox/Runtime/r3/posix


Ignore:
Timestamp:
Feb 5, 2013 11:56:23 PM (12 years ago)
Author:
vboxsync
Message:

process-creation-posix.cpp: posix_spawnattr_setsigmask doesn't take effect without setting the POSIX_SPAWN_SETSIGMASK flag. Check status codes. kLIBC actually implements posix_spawnattr_setflags and ignores flags it doesn't implement IIRC, so lose the #ifndef RT_OS_OS2 bits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/process-creation-posix.cpp

    r44549 r44555  
    467467        if (!rc)
    468468        {
    469 # ifndef RT_OS_OS2 /* We don't need this on OS/2 and I don't recall if it's actually implemented. */
    470             rc = posix_spawnattr_setflags(&Attr, POSIX_SPAWN_SETPGROUP);
     469            /* Indicate that process group and signal mask are to be changed,
     470               and that the child should use default signal actions. */
     471            rc = posix_spawnattr_setflags(&Attr, POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF);
    471472            Assert(rc == 0);
     473
     474            /* The child starts in its own process group. */
    472475            if (!rc)
    473476            {
     
    475478                Assert(rc == 0);
    476479            }
    477 # endif
    478             sigset_t sigmask;
    479             sigemptyset(&sigmask);
    480             rc = posix_spawnattr_setsigmask(&Attr, &sigmask);
    481             Assert(rc == 0);
     480
     481            /* Unmask all signals. */
     482            if (!rc)
     483            {
     484                sigset_t SigMask;
     485                sigemptyset(&SigMask);
     486                rc = posix_spawnattr_setsigmask(&Attr, &SigMask); Assert(rc == 0);
     487            }
    482488
    483489            /* File changes. */
    484490            posix_spawn_file_actions_t  FileActions;
    485491            posix_spawn_file_actions_t *pFileActions = NULL;
    486             if (aStdFds[0] != -1 || aStdFds[1] != -1 || aStdFds[2] != -1)
     492            if ((aStdFds[0] != -1 || aStdFds[1] != -1 || aStdFds[2] != -1) && !rc)
    487493            {
    488494                rc = posix_spawn_file_actions_init(&FileActions);
     
    534540                 * it's not worth doing anything as this process must exit. */
    535541                if (fFlags & RTPROC_FLAGS_DETACHED)
    536                 _Exit(0);
     542                    _Exit(0);
    537543                if (phProcess)
    538544                    *phProcess = pid;
     
    592598             * Unset the signal mask.
    593599             */
    594             sigset_t sigmask;
    595             sigemptyset(&sigmask);
    596             sigprocmask(SIG_SETMASK, &sigmask, NULL);
     600            sigset_t SigMask;
     601            sigemptyset(&SigMask);
     602            rc = sigprocmask(SIG_SETMASK, &SigMask, NULL);
     603            Assert(rc == 0);
    597604
    598605            /*
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