summaryrefslogtreecommitdiff
path: root/src/stdio/popen.c
AgeCommit message (Collapse)AuthorFilesLines
2013-09-01fix special-case breakage in popen due to reversed argument orderRich Felker1-1/+1
2013-03-24rewrite popen to use posix_spawn instead of fragile vfork hacksRich Felker1-41/+41
2012-11-08clean up sloppy nested inclusion from pthread_impl.hRich Felker1-0/+3
this mirrors the stdio_impl.h cleanup. one header which is not strictly needed, errno.h, is left in pthread_impl.h, because since pthread functions return their error codes rather than using errno, nearly every single pthread function needs the errno constants. in a few places, rather than bringing in string.h to use memset, the memset was replaced by direct assignment. this seems to generate much better code anyway, and makes many functions which were previously non-leaf functions into leaf functions (possibly eliminating a great deal of bloat on some platforms where non-leaf functions require ugly prologue and/or epilogue).
2012-10-21fix copy/paste error in popen changes that broke signalsRich Felker1-1/+1
signal mask was not being restored after fork, but instead blocked again.
2012-10-19fix usage of locks with vforkRich Felker1-1/+1
__release_ptc() is only valid in the parent; if it's performed in the child, the lock will be unlocked early then double-unlocked later, corrupting the lock state.
2012-10-18overhaul system() and popen() to use vfork; fix various related bugsRich Felker1-24/+44
since we target systems without overcommit, special care should be taken that system() and popen(), like posix_spawn(), do not fail in processes whose commit charges are too high to allow ordinary forking. this in turn requires special precautions to ensure that the parent process's signal handlers do not end up running in the shared-memory child, where they could corrupt the state of the parent process. popen has also been updated to use pipe2, so it does not have a fd-leak race in multi-threaded programs. since pipe2 is missing on older kernels, (non-atomic) emulation has been added. some silly bugs in the old code should be gone too.
2012-06-20make popen cancellation-safeRich Felker1-0/+7
close was the only cancellation point called from popen, but it left popen with major resource leaks if any call to close got cancelled. the easiest, cheapest fix is just to use a non-cancellable close function.
2012-06-20popen: handle issues with fd0/1 being closedRich Felker1-3/+3
also check for failure of dup2 and abort the child rather than reading/writing the wrong file.
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker1-0/+43