Reopening stdin, stdout and stderr if they are pointing to /dev/null.

The dup2 syscall is actually closing and reopening the fd :) If you think that is misleading, I will delete that comment.