Minor caveat: EBUSY is a Linux-ism.  The BSDs never return it and I'm pretty sure Solaris doesn't either.

Probably doesn't hurt now but might be good to exclude it, just in case dup2() in the future does start returning EBUSY but with semantics that are different from Linux.