Message169405
Here's my initial fix.
If fcntl(errpipe_write, F_DUPFD, 3) is widely available this could be shrunk a bit to avoid the for loop potentially calling dup a few times and tracking the wasted fds to close later.
Otherwise if it isn't I'd rather not bother with F_DUPFD as this code takes the optimal path when F_DUPFD_CLOEXEC is supported (true on all modern linux systems) and should cause no harm beyond a couple extra dup and close syscalls otherwise.
Note: Linux pipe2() support appears in kernels a few revisions after F_DUPFD_CLOEXEC support so the good behavior when pipe2 exists will be kept in this situation as that also means F_DUPFD_CLOEXEC support should exist. The code will work regardless of that (incase someone has a frankenkernel, or other OSes choose to implement one but not the other). |
|
Date |
User |
Action |
Args |
2012-08-29 18:21:12 | gregory.p.smith | set | recipients:
+ gregory.p.smith, pitrou, ezio.melotti, cvrebert, rosslagerwall, sarum9in |
2012-08-29 18:21:12 | gregory.p.smith | set | messageid: <1346264472.12.0.137787965448.issue15798@psf.upfronthosting.co.za> |
2012-08-29 18:21:11 | gregory.p.smith | link | issue15798 messages |
2012-08-29 18:21:10 | gregory.p.smith | create | |
|