summaryrefslogtreecommitdiffstats
path: root/spawn.c
Commit message (Collapse)AuthorAgeFilesLines
* spawn: Allow NULL envp for the current environmentTavian Barnes2021-06-131-0/+5
|
* spawn: New bfs_spawn_addsetrlimit() actionTavian Barnes2021-05-201-0/+19
|
* util: Tweak the safe read/write functionsTavian Barnes2021-04-151-4/+4
|
* util: add safe_read_all() and safe_write_all() functions.Markus F.X.J. Oberhumer2021-04-151-2/+2
|
* util: introduce safe versions of read & write that handle interruptedMarkus F.X.J. Oberhumer2021-04-151-7/+4
| | | | systems calls.
* Fix up some #includesTavian Barnes2021-02-051-1/+0
|
* Include what I useTavian Barnes2020-11-121-1/+0
| | | | Thanks to https://github.com/include-what-you-use/include-what-you-use
* spawn: Fix error pipe write failure handlingTavian Barnes2020-11-041-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A short history lesson: this code (from exec.c) used to just be write(...); In 649d85b, an empty if block was added to placate _FORTIFY_SOURCE's warn_unused_result: if (write(...) != sizeof(error)) { // ... } This is fine since the parent doesn't rely on receiving those writes (e.g. the child could die before writing), and the small write to a pipe won't fail anyway. But when bfs_spawn() was created, the implementation changed to this: while (write(...) < sizeof(error)); The while loop was presumably added to mirror musl's posix_spawn() implementation, which handles EINTR. But musl's is actually correct: while (write(...) < 0); whereas mine has a subtle bug: since sizeof(error) is unsigned, the bfs code did an unsigned comparison, meaning -1 from write() would *not* restart the loop. Fix it by comparing with 0 like musl, since short writes are impossible here. Perhaps it's time for -Wsign-compare, despite the other 18 instances being false positives.
* spawn: Actually fix moving the pipe out of the wayTavian Barnes2019-07-081-7/+7
| | | | | We have to check in_fd after out_fd, otherwise the dup() may move it to in_fd.
* spawn: Fix moving the pipe out of the wayTavian Barnes2019-07-051-3/+9
| | | | | The old code could dup() the pipe from in_fd to out_fd, for example, and neglected to keep it CLOEXEC.
* spawn: Move the pipe FD out of the way of input FDs tooTavian Barnes2019-06-161-1/+1
|
* spawn: Add dup2() and close() file actionsTavian Barnes2019-05-311-5/+60
|
* spawn: Add some docsTavian Barnes2018-09-191-8/+11
|
* spawn: Implement execvpe() on platforms that lack itTavian Barnes2018-09-191-1/+11
| | | | | | Credit to https://github.com/nim-lang/Nim/issues/3138 for the idea to just overwrite environ and call execvp() instead of duplicating the path searching logic.
* spawn: New posix_spawn()-like API for execTavian Barnes2018-09-181-0/+158