properly handle return code of pipe() syscall