Use g_dir_open() and friends instead of opendir() and friends.