Page MenuHomeFreeBSD

Fix the case where stdin is closed, second attempt.
ClosedPublic

Authored by markj on Feb 16 2019, 8:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Aug 13, 9:12 PM
Unknown Object (File)
Wed, Aug 12, 11:41 AM
Unknown Object (File)
Mon, Aug 10, 10:21 AM
Unknown Object (File)
Mon, Aug 10, 9:39 AM
Unknown Object (File)
Sun, Aug 9, 12:12 AM
Unknown Object (File)
Fri, Aug 7, 2:43 AM
Unknown Object (File)
Jul 24 2026, 9:11 PM
Unknown Object (File)
May 20 2026, 12:56 AM
Subscribers

Details

Summary

We have to be careful with caph_limit_stdio(): we cannot use it if one
of the input files is stdin, and we cannot use it after opening the
input files, since if one of the standard descriptors is closed it may
be reused for one of the input files.

Rather than partially duplicating caph_limit_stream() in main(), limit
rights in c_regular() and c_special(). Don't register a SIGSEGV handler
until we're committed to using mmap().

Add a regression test.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable