]> git.ipfire.org Git - thirdparty/curl.git/commit
tool_main: exit at once if out of file descriptors
authorDaniel Stenberg <daniel@haxx.se>
Wed, 5 Oct 2022 08:33:07 +0000 (10:33 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 7 Oct 2022 15:45:07 +0000 (17:45 +0200)
commit41e1b30ea1b77e9ffb3bf0f6b6a857aa60df88fe
tree8f90ede28b00dfb7fad09d892f4b817578552fd1
parente3f335148adc6742728ff8fef4a011d42fa5c7b1
tool_main: exit at once if out of file descriptors

If the main_checkfds function cannot create new file descriptors in an
attempt to detect of stdin, stdout or stderr are closed.

Also changed the check to use fcntl() to check if the descriptors are
open, which avoids superfluously calling pipe() if they all already are.

Follow-up to facfa19cdd4d0094

Reported-by: Trail of Bits
Closes #9663
src/tool_main.c