Replace readdir_r to readdir to fix build error