platform_bionic/libc/private
Elliott Hughes 468efc80da Reimplement popen(3)/pclose(3).
pclose(3) is now an alias for fclose(3). We could add a FORTIFY check
that you use pclose(3) if and only if you used popen(3), but there seems
little value to that when we can just do the right thing.

This patch also adds the missing locking to _fwalk --- we need to lock
both the global list of FILE*s and also each FILE* we touch. POSIX says
that "The popen() function shall ensure that any streams from previous
popen() calls that remain open in the parent process are closed in the
new child process", which we implement via _fwalk(fclose) in the child,
but we might want to just make *all* popen(3) file descriptors O_CLOEXEC
in all cases.

Ignore fewer errors in popen(3) failure cases.

Improve popen(3) test coverage.

Bug: http://b/72470344
Test: ran tests
Change-Id: Ic937594bf28ec88b375f7e5825b9c05f500af438
2018-07-11 12:15:26 -07:00
..
__get_tls.h AArch64: Add initial support for AArch64 2013-12-16 17:00:22 -08:00
bionic_arc4random.h Inline __libc_arc4random_has_unlimited_entropy. 2018-02-06 15:35:15 -08:00
bionic_asm.h Mark __BIONIC_WEAK_FOR_NATIVE_BRIDGE symbols 2017-10-27 10:01:46 +02:00
bionic_asm_arm.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_asm_arm64.h Set __bionic_asm_align to 16 for arm64 2018-06-26 15:58:52 -03:00
bionic_asm_mips.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_asm_x86.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_asm_x86_64.h Unified sysroot: kill arch-specific include dirs. 2017-10-12 13:19:51 -07:00
bionic_auxv.h Switch <elf.h> over to linux uapi under the covers. 2014-02-10 18:22:24 -08:00
bionic_config.h Use a separate config.h for config like defines. 2014-06-16 23:35:53 -07:00
bionic_constants.h Add semaphore tests, fix sem_destroy. 2014-09-19 17:37:06 -07:00
bionic_ctype.h Use inline ctype functions for ato*/strto* and scanf. 2017-12-19 16:37:01 -08:00
bionic_defs.h Mark __BIONIC_WEAK_FOR_NATIVE_BRIDGE symbols 2017-10-27 10:01:46 +02:00
bionic_errdefs.h Move <sys/_sigdefs.h> and <sys/_errdefs.h> to private. 2016-04-13 17:45:39 -07:00
bionic_fortify.h bionic_fortify: clarify error message for an out of bounds FD. 2018-03-14 12:37:25 +00:00
bionic_futex.h Support priority inheritance mutex in 64bit programs. 2018-01-24 16:11:07 -08:00
bionic_globals.h Remove valgrind workarounds. 2018-06-12 15:29:36 -07:00
bionic_ieee.h Fix instances of '#if __LP64__'. 2016-09-15 14:21:28 -07:00
bionic_lock.h Add ability to read /etc/passwd and /etc/group 2018-02-08 12:38:57 -08:00
bionic_macros.h Only use uids and gids for which we've allocated AIDs 2017-11-15 10:31:49 -08:00
bionic_malloc_dispatch.h Add aligned_alloc to libc. 2018-02-07 06:57:14 -08:00
bionic_mbstate.h Include what we use. 2018-01-22 12:20:16 -08:00
bionic_page.h Move PAGE_MASK into <sys/user.h>. 2015-07-28 14:58:37 -07:00
bionic_prctl.h Label pages mapped by linker_allocator 2014-08-11 09:22:48 -07:00
bionic_sdk_version.h Revert "Revert "Make sem_wait able to return errno EINTR for sdk > 23."" 2016-01-25 17:39:18 -08:00
bionic_sigdefs.h Move <sys/_sigdefs.h> and <sys/_errdefs.h> to private. 2016-04-13 17:45:39 -07:00
bionic_ssp.h Simplify __stack_chk_fail, and fix it so we get debuggerd stack traces. 2013-02-14 14:37:34 -08:00
bionic_string_utils.h Fix pthread_getattr_np for the main thread. 2014-08-26 10:36:38 -07:00
bionic_systrace.h Add end() method to bionic's ScopedTrace class 2017-03-20 12:45:55 -07:00
bionic_time_conversions.h Always use CLOCK_MONOTONIC for pthreads and semaphores 2017-08-18 09:11:05 -07:00
bionic_tls.h Add a legacy inline for mmap64. 2017-10-05 23:41:47 -07:00
bionic_vdso.h Clean up the time(2) implementation. 2018-01-12 15:20:28 -08:00
CachedProperty.h Address a bunch of clang-tidy complaints. 2018-01-19 15:56:12 -08:00
CFIShadow.h Revert "Revert "arm64: expand CFI shadow to cover 48-bit virtual addresses"" 2017-08-03 14:11:28 -07:00
ErrnoRestorer.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
FdPath.h Add POSIX fexecve. 2017-10-18 16:26:17 -07:00
get_cpu_count_from_string.h Fix the way to count online cpus. 2015-09-29 17:49:37 -07:00
grp_pwd.h Require vendor users and groups to start with vendor_ 2018-05-15 14:10:21 -07:00
icu.h Implement <iconv.h>. 2017-08-25 08:47:41 -07:00
KernelArgumentBlock.h Address a bunch of clang-tidy complaints. 2018-01-19 15:56:12 -08:00
NetdClientDispatch.h Mark sockets on creation (socket()) and accept4(). 2014-05-19 15:19:16 -07:00
ScopedPthreadMutexLocker.h Explicitly disallow default c-tor 2015-12-01 16:57:19 -08:00
ScopedReaddir.h Implement scandirat and scandirat64. 2015-10-27 13:47:36 -07:00
ScopedSignalBlocker.h Rewrite system(3) to use posix_spawn(3). 2018-03-05 17:20:12 -08:00
ScopedSignalHandler.h Rewrite system(3) to use posix_spawn(3). 2018-03-05 17:20:12 -08:00
sigrtmin.h Filter out reserved signals in functions that take sigset_t. 2018-02-27 14:12:30 -08:00
SigSetConverter.h Add sigset64_t and accompanying functions. 2018-01-30 18:47:16 -08:00
thread_private.h Reimplement popen(3)/pclose(3). 2018-07-11 12:15:26 -07:00
WriteProtected.h Move libc_log code into libasync_safe. 2017-05-03 08:50:43 -07:00