that, should have been: if((sfd = stream(fd)) >= 0){ dup(sfd, fd); close(sfd); } -- cinap