It's both complex and flawed, as ZmnSCPxj points out. Make a generic fd ordering routine, and use it. Plus, test it! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>