VirtualBox

Changeset 106779 in vbox


Ignore:
Timestamp:
Oct 29, 2024 10:10:06 PM (4 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
165670
Message:

IPRT/r3/init: Ignore SIGPIPE during init to avoid anyone using sockets or pipes directly to need to do so. bugref:10268

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/init.cpp

    r106061 r106779  
    526526#endif /* IPRT_USE_SIG_CHILD_DUMMY */
    527527
     528#ifndef RT_OS_WINDOWS
     529    /*
     530     * Ignore SIGPIPE if it is configured as SIG_DFL.
     531     */
     532    if (!(fFlags & RTR3INIT_FLAGS_UNOBTRUSIVE))
     533    {
     534        struct sigaction SigActOld;
     535        rc = sigaction(SIGPIPE, 0, &SigActOld);
     536        AssertMsg(rc == 0, ("%d/%d\n", rc, errno));
     537        if (   rc == 0
     538            && !(SigActOld.sa_flags & SA_SIGINFO)
     539            && SigActOld.sa_handler == SIG_DFL)
     540        {
     541            struct sigaction SigAct;
     542            memset(&SigAct, 0, sizeof(SigAct));
     543            SigAct.sa_handler = SIG_IGN;
     544            rc = sigaction(SIGPIPE, &SigAct, &SigActOld);
     545            AssertMsg(rc == 0, ("%d/%d\n", rc, errno));
     546            Assert(SigActOld.sa_handler == SIG_DFL || rc != 0);
     547        }
     548    }
     549#endif
     550
    528551#ifdef IPRT_WITH_ALIGNMENT_CHECKS
    529552    /*
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