From: Doug Gwyn (VLD/VMB) <gwyn at brl-vld> Your dup2() emulation incorrectly returns an error indication if fildes2 is not open. The close() return value should be ignored: (void)close(fildes2);