platform_bionic/libc/upstream-netbsd
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
..
android/include libc: Add support to allow library calls to find appropriate shell executable for a process 2017-08-22 10:17:28 -07:00
common/lib/libc Get the full set of PRNG functions in <stdlib.h> 2014-06-12 14:37:31 -07:00
lib/libc Reimplement popen(3)/pclose(3). 2018-07-11 12:15:26 -07:00
README.md Move to .md files for even trivial documentation. 2017-01-07 12:47:28 -08:00

This directory contains upstream NetBSD source. You should not edit these files directly. Make fixes upstream and then pull down the new version of the file.

TODO: write a script to make this process automated.