Add open_check_file() to replace open/[fl]stat.