Fix bad condition on checking the return value of opendir()