On OS X*, the scan_dirs() function gets stuck in an infinite loop, comparing the same file with itself. After reading the Mac OS X manual page for the *dir() functions, it seemed to have been due to the position in the directory obtained by telldir() becoming invalid after the closedir() and then following opendir(). After adding a #ifdef APPLE with a different way of doing things, the same infinite loop is happening.
*High Sierra
On OS X*, the scan_dirs() function gets stuck in an infinite loop, comparing the same file with itself. After reading the Mac OS X manual page for the *dir() functions, it seemed to have been due to the position in the directory obtained by telldir() becoming invalid after the closedir() and then following opendir(). After adding a #ifdef APPLE with a different way of doing things, the same infinite loop is happening.
*High Sierra