Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dup() can fail; check whether it does.
If, for example, you run out of file descriptors, dup() can fail, and ws_dup() is a wrapper around it on UN*X. Don't just pass the result of ws_dup() to ws_fdopen(); instead, save its result, check against -1 and, if it's -1, give up, otherwise pass it to ws_fdopen(). This addresses Coverity CID 1471708. Also, if ws_fdopen() fails, close the descriptor we got from ws_dup(); this closes a possible FD leak.
- Loading branch information