Hi mjg,
Diff2 ID:10314 and Diff 3 ID:10315 provide alternative solutions to eliminate abort() in popen() along the lines of your thought.
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
Feed Advanced Search
Advanced Search
Advanced Search
Nov 19 2015
Nov 19 2015
popen() attempts to allocate resources (memory, file stream) before child creation.
Modifications focus on minimum resources and apply to a couple of lines in parent.
Nov 12 2015
Nov 12 2015
Hi mjg,
Here we are hitting the case of resource limits getting exhausted (max file streams opened hits the ceiling). Following are the options we can take to solve the problem:
- It is conventional practice to generate exception like abort() in software indicating there is something critically wrong so that the issue can be debugged at the earliest.
- Check for failures, undo things already done in the function path (close files, free memory, etc.,.) and return error. In such cases, the system
may end up with side-effect problems or exit indicating error. It may not be possible to undo all things. This increases complexity.
Option 1 is preferable since it keeps things simple.
Nov 11 2015
Nov 11 2015
Check is added for fdopen() returning NULL and corresponding error message emitted through perror() followed by abort() exception generation.
rtpbusr_gmail.com retitled D4126: popen requires check for fdopen failure from to popen requires check for fdopen failure.