Front Page (inb4 what's that?) WTF
-
The code being criticised:
nsel = select(max(pty_fd, net_fd), &rdset, NULL, NULL, NULL);
The criticism:
At a glance, this code just looks wrong. The first parameter to select is the number of file descriptors. Passing max(pty_fd, net_fd) implies that we’re passing whichever file descriptor just happens to be the larger number, which makes no sense.
Except, from the link provided on that self-same page:
nfds [the parameter under considerationhere - ed] should be set to the highest-numbered file descriptor in any of the three sets, plus 1. The indicated file descriptors in each set are checked, up to this limit (but see BUGS).
-
Isn't really the first time Remy failed his research and committed a inside an article. Nothing to see here