I'm seeing an issue using both sockets and pipes in Linux. Specifically, we call pipe(), which allocates the next two available file descriptors... let's say 10 and 11. Then we call accept() on a socket, expecting it to allocate 12. Instead, it allocates 11.
We've tested a bit, and it seems the second FD returned from pipe() is always available for reuse by other syscalls that create file descriptors.
Can anyone explain this?