Anyone want to take a stab at why the following is really problematic? fcntl(0, F_SETFL, O_NONBLOCK);
-
-
Replying to @RichFelker
I guess because the file description is likely shared between child and parent processes? And so if the child unexpectedly terminates (or backgrounds) then the parent is left with stdin in non-blocking mode, which it doesn't know how to deal with?
1 reply 0 retweets 5 likes
Replying to @davmac314
Yep, exactly. It's unexpectedly (due to programmer confusion about file descriptors vs descriptions) modifying shared state. Try in an interactive shell, and "read x" after the program exits.
9:39 AM - 1 Oct 2018
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.