Add function get_null_fd(), to reduce code redundancy.